Hi, 
I have a question regarding GeneratedIds, I have a property of my mapped class 
(it has 2 props: String content & @Id @GeneratedValue Long id) - the string 
should be unique, it could contain up to 255 chars. However, I expect often 
that data is entered which is already persistent, so I use merge() instead of 
persist(). Now, merge() seems to work only if I have an id set, i.e. there is 
already an object in the DB (1,"hello") and I create a new Object(,"hello") and 
want to merge it, then I get a ConstraintViolationException - if I leave out 
the Long id and use the "hello" as the Id (via @Id), then it works - however 
then I have so much redundant data  - e.g. if I use the String content as a 
Foreign Key, all the other tables will also have this 255 char string inside 
instead of a tiny number... is there any other way I can do this? 

Thanks, 
Joey

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975587#3975587

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975587
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to