Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[JPA] How to auto-inc a filed in ClassA based on value of a field in classB?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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.

Any comment is very welcome.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic