• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt in one-to-one association mapping

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your mapping doesn't provide any relationship column information.

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/associations.html#assoc-unidirectional-121
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-onetoone
 
Mikey Schmidt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic