• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

OneToMany <-> ManyToOne relationship

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am developing an EJB 3.0 web app on Oracle WebLogic Server 11gR1 PatchSet 1, and I am having problems
on update/delete with the relationship.

I have an entity Customer with two children DiscountCode an MicroMarket. The relation is many Customer has
one DiscountCode and many Customer has one MicroMarket. On the other direction it leaves as one DiscountCode
has many Customer and one MicroMarket has many Customer.

This is my code snippet,

Customer.-


MicroMarket.-


The problem I am having is when I update the MicroMarket.zip_code in a Customer I get another record of
MicroMarket instead of an updated MicroMarket.

On delete a Customer it does not delete the MicroMarket.

And I have not any idea how is it done.

Help!!!


Best Regards,
Jose
 
Ranch Hand
Posts: 466
1
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think when parent is deleted all child would be automatically deleted (OneToMany). However in case of MnayToOne on deletion of child Parent deletion is not happening... it this the case here??
 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your quickly reply.

Well, I work only with Customer. So what I would like is when I delete a Customer
just only the MicroMarket child would be deleted.

The problem I have is that MicroMarket child is not deleted. That is wrong.

On the other hand the table corresponding to the DiscountCode entity must
leaves as it is without no update, no insert and no delete.

Regards,
Jose
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic