File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Id problem in annotation based mapping when using xml based id. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Id problem in annotation based mapping when using xml based id." Watch "Id problem in annotation based mapping when using xml based id." New topic
Author

Id problem in annotation based mapping when using xml based id.

Manuel Petermann
Ranch Hand

Joined: Jul 19, 2011
Posts: 175

Ok first the xml:

Now the annotated classes:


What I need is to switch between the ids but it doesn't work as i figured.
if I run this i got the exception:
org.hibernate.AnnotationException: No identifier specified for entity: eu.gdimbh.cardea.database.entity.DataCategory

I read somewhere that it is possible to mix annotation and xml. But either that is not true or I am doing something wrong.
I hope i am doing something wrong cause i got no other idea how to switch through ids.

Thanks in advance.

EDIT: Got it solved.
Mapping was wrong.
I used:


and it seems to work.

Edit 2: For future reference. Dump this approach and use uuids. If anyone won't get a better idea.


Please correct my English.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Id problem in annotation based mapping when using xml based id.