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

How to delete individual entity in @OneToOne without affecting each other?

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi there
Can any one explain how to proceed?
Say,there are two entities
Orders------------->Shipments. Relationship is @OnetoOne and Uni-directional.

public class Orders implements Serializable {
@Id
@Basic(optional = false)
@Column(name = "OrderId")
private String orderId;
@Column(name = "OrderName")
private String orderName;
@OneToOne(cascade={CascadeType.PERSIST})
private Shipments objShipment;
}

public class Shipments implements Serializable {
@Id
@Column(name = "ShpmentId")
private String shpmentId;
@Column(name = "City")
private String city;
}

In some cases, I need to delete only Order entity but that deletion should not affect the
Shipment entity at all or it may be vice versa. How to Proceed?
I am stuck.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
 
Run away! Run away! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic