This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes EJB with multiple MapKeys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "EJB with multiple MapKeys" Watch "EJB with multiple MapKeys" New topic

EJB with multiple MapKeys

Thorsten Kreis

Joined: Jul 26, 2009
Posts: 1

I want to implement EJB with @MapKey and use JBoss 5.1.0.GA.
The following works perfectly (object A):

The database tables (mysql) will look like this:
Table A
Table B,
Table A_B with (A_id, name_id)

But I need more Maps like 'name' in A, e.g.

The database tables (mysql) will look like this:
Table A
Table B,
Table A_B with (A_id, name_id,symbol_id)

If I want to persist a object A (with a single object B in the Map name) I get this error:
Caused by: java.sql.BatchUpdateException: Field 'symbol_id' doesn't have a default value

I'm surprised a little bit about the databse structure and understand the error, but how to solve this??

Thank you
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 9947

Moving to our ORM/JPA forum where you might get some answers.

[My Blog] [JavaRanch Journal]
Consider Paul's rocket mass heater.
subject: EJB with multiple MapKeys
Similar Threads
How do I create Hibernate criteria when using a many to one mapping
JPA data retrieval query
JPA self refrencing relationship problem...HELP Needed
Implementation of association classes and mapping in hibernate
Why is my Hibernate Search query not working?