Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Annotation limitation with two IDs(one per Configuration)  RSS feed

Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to write a Hibernate application on a semi-standalone client with a postgresql database on it.
If you want you may sync the database with the server site.
Problem which occured is:
Client one creates a new entity, client two creates a new entity of the same class. Both have the same ID when uploading to the server.
My sollution now was to use a master Id field for the server side id and a id field for the clients.
Problem now: How to tell hibernate with annotations which Id field to use for which connection?
If its not possible, is it good practice to use xml based mapping mixed with annotations?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!