[JPA] How to auto-inc a filed in ClassA based on value of a field in classB?
posted 7 years ago
Sorry if my title is not enough expressive.
I have an entity class named Brocj and it has a field named row. I have another object named Cont with a field named contNum. Bocj and Cont have a one-to-many relation with eachother.
The row field should act as a counter for Brocj entity stored for a particular Cont entity. The objects can be added by multiple clients in the network. I can not understand how I can do this. I am using JPA to implement the application.
I'm not sure if you're going to get this 'out of the box' with Hibernate or JPA. You may need to just write some Java logic or JDBC query logic and insert the results of this logic into your application.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads