aspose file tools*
The moose likes Object Relational Mapping and the fly likes hibernate to JPA: generator class=increment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate to JPA: generator class=increment" Watch "hibernate to JPA: generator class=increment" New topic
Author

hibernate to JPA: generator class=increment

David Balažic
Ranch Hand

Joined: May 15, 2008
Posts: 86
Hi!

Can the following mapping be migrated from hibernate to JPA?


That is with minimum other changes?

Currently I try

But it gives this error when trying to persis an object:


Regards,
David
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
Add how the value will be generated.

Like


Thanks,
Prabhat
SCJP 1.5, SCWCD 1.5, SCBCD 1.5
David Balažic
Ranch Hand

Joined: May 15, 2008
Posts: 86
GenerationType has no value for "increment".
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
I am not sure i got what you meant? Can you elaborate please ?
David Balažic
Ranch Hand

Joined: May 15, 2008
Posts: 86
I guess I did not understand you.

What did you mean by "Add how the value will be generated. " ?

In old project it was created automatically by hibernate.

How to have the same with JPA?
David Balažic
Ranch Hand

Joined: May 15, 2008
Posts: 86
David Balažic wrote:Hi!

Can the following mapping be migrated from hibernate to JPA?


OK, a coworker found the solution:



In case anyone else asks the same question...


Regards,
David
Michael Knoke
Greenhorn

Joined: Feb 08, 2010
Posts: 1
Thanks for the solution. However, I note that going this way requires me to add the import for GenericGenerator which is: org.hibernate.annotations.GenericGenerator

I was always taught that if I was using just JPA then I would never see a "org.hibernate" import; is this just wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate to JPA: generator class=increment
 
Similar Threads
Could not find a getter for id1 in class ........
can you have one-to-many join without using identifier column?
Hibernate2, composite-id, mappingException
Hibernate Newbie - 1 to Many Relation Tutorial
many to one unidirectional propertyaccessexception