aspose file tools*
The moose likes Oracle/OAS and the fly likes OneToMany <-> ManyToOne relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "OneToMany <-> ManyToOne relationship" Watch "OneToMany <-> ManyToOne relationship" New topic
Author

OneToMany <-> ManyToOne relationship

Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
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
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 466
    
    1

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??


Vinod Tiwari | Twitter | Shikshanirman | Guftgu
Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
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
 
 
subject: OneToMany <-> ManyToOne relationship