Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Bean for multiple tables  RSS feed

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you have 1 bean for multiplee table in EJB3.0?

I have two tables called tbl_user_details & tbl_user_secure, I want to populate both at the same time upon registering a new user account.

I have had a look around and saw that you can do the following


But as soon as my app gets to the first property from the tbl_user_secure table I get the following error:



I don't really want to have seperate Entity beans if I cn help it, because that would make rolling back arkward, where a single bean would pretyy much sort itself out.

Cheers

KS
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorted it.

@Entity
@Table(name = "tbl_user_details")
@SecondaryTable(name = "tbl_user_secure", pkJoinColumns = @PrimaryKeyJoinColumn(name="id"))



@Column(name = "username", table="tbl_user_secure")
@Column(name = "password", table="tbl_user_secure")
etc etc etc
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!