-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Schemaexport error moving from PostgreSQL to MS SQL Server
PostPosted: Tue May 04, 2004 3:54 am 
Newbie

Joined: Tue May 04, 2004 2:33 am
Posts: 2
Location: Cape Town, South Africa
I am using Hibernate 2.1.2 and generate XML mappings using XDoclet.

I use the 'native' identity generator because one of the clients using the product deploys on MS SQL Server. Otherwise I develop and deploy on PostgreSQL.

My java files all have:
Code:
   /**
    * Returns the primary key.
    * @hibernate.id column="userid" generator-class = "sequence"
    * @hibernate.generator-param name="native" value="tbluser_userid_seq"
    * @return
    */
   public Long getUserId() {
      return userId;
   }


I use ant to do all the generation and schemaexport. It has worked beautifully until I tried to switch to MS SQL Server 2000.

Now, when I run the schemaexport task I get the following error:

[schemaexport] BUILD FAILED: file:/home/lisa/workspace/pacs/build.xml:156: Schema text failed: could not instantiate id generator

I can't seem to get a more detailed stack trace via ant, even with the -v (verbose) param on.

The driver I am using for MS SQL Server is the jTDS (http://jtds.sourceforge.net/) 0.8 rc1.

I have tried changing the class generator to 'identity', and a number of commercial drivers (listed on the hibernate compatability page), but with the same results.

Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 04, 2004 2:08 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
What about if you just use:
Code:
  /**
    * Returns the primary key.
    * @hibernate.id column="userid" generator-class = "native"
    * @return
    */
   public Long getUserId() {
      return userId;
   }

.. on all your objects.

Yes - it's me


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 04, 2004 4:36 pm 
Newbie

Joined: Tue May 04, 2004 2:33 am
Posts: 2
Location: Cape Town, South Africa
Works like a bomb. Thanks :)

Damn, that was stupid of me. I think I need a day off.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 12:54 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Cool.
Quote:
I think I need a day off.

Me too boss ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.