In my app, I have two persistent objects: things related to things and tag tags containing tags containing things Can do. The tag is a unique name for objects (it does not make sense to tag it twice with the same tag).
When a Thing (tag objects are attached) is already present in DB. Now this is the part that I can not remember about JPA, is there any way to tell the JPA that DB should not try to add related items, if it violates the unique obstacle? Or is it a way to accomplish all these things efficiently in this manner, then merge the collection into memory and then write everything?
I am also wondering if it is possible to continue on the whole collection at the same time or do I have to call firmly for every thing while using the JAPA?
I do not know any way to do this 'cleanup', neither with JPA and hibernation Not in or with any other provider. What do you want to do with a custom SQL query, though (similar):
@tainty (name = "tag") @SQLInsert (sql = "tag (name, count) Values (?,?) Duplicate key update set count = count + 1 ") Public class tag {} You are now unfortunately bound for both Hibernate and MySQL. You can change the SQL syntax for the S, and / or use the stored procedures, before the first update Confidence and can include failure etc. Everyone has their drawbacks, so JPA supports this, but alas.
Regarding your second question, the JPA continues with the entire object graph, including the support archive.
Comments
Post a Comment