Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in one-to-one association mapping

 
Mikey Schmidt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm relatively new to Hibernate and I'm having lot of confusions with mappings:

Tables:


mapping:

1) Is there a way to persist the class MedCustomer and CustomerDetail without having a link in CustomerDetail class for seting parent's ID .. like:


2) Incase I try to load all the MedCustomer .the join happens between CUSTOMER_MASTER.CUST_ID and CUSTOMER_DETAILS.CUST_DETAIL_ID , which is incorect. How to overcome this proeblem?
 
Mikey Schmidt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even after providing the relationsship column info its not working properly

when i try to load a MedCustomer , I get


SEVERE: IllegalArgumentException in class: com.medapp.util.CustomerDetail, setter method of property: parentcustID
SEVERE: expected type: int, actual value: com.medapp.util.MedCustomer


forcing me to change the setter method in CustomerDetail with MedCustomer as argument (although it does work in that case, but isnt that suppose to be handled by hibernate itself)

Secondly incase I change setter .. Its giving error when i try to persist a new MedCustomer Object
Field 'CUST_ID' doesn't have a default value


Am I missing here something?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic