File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to delete individual entity in @OneToOne without affecting each other? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply locked New topic
Author

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

Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39529
    
  27
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to delete individual entity in @OneToOne without affecting each other?
 
Similar Threads
Problem while One to One Relationship
Please explain this @OneToOne
How to delete individual entity in @OneToOne without affecting each other?
please, help me to solve sun.jdbc.odbc.JdbcOdbcDriver cannot be cast to javax.sql.DataSource
Hibernate's update problem