Thanks for the Reply Pinaki. Below is the code as requested



@Entity
@Table(name="APPLICATION")

public class Application{
        
        @Id     
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "APPLICATION_ID")
        private long applicationId;     

        @OneToMany(mappedBy="application", 
                            cascade={CascadeType.ALL} , 
                            fetch=FetchType.EAGER)
        private List<ApplicationMember> applicationMember;

        public long getApplicationId() {
                return applicationId;
        }

        public void setApplicationId(long applicationId) {
                this.applicationId = applicationId;
        }

        public List<ApplicationMember> getApplicationMember() {
                return applicationMember;
        }

        public void setApplicationMember(List<ApplicationMember> 
applicationMember) {
                this.applicationMember = applicationMember;
        }

                 
}



@Entity
@Table(name="APPLICATION_MEMBER")

public class ApplicationMember {
        
        
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "NAME_ID") 
        private long nameId;
        
        @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, 
CascadeType.PERSIST,CascadeType.REFRESH})
        @JoinColumn(referencedColumnName="APPLICATION_ID", 
name="APPLICATION_ID")
        private Application application;
        
        
        @Column(name = "LAST_NM")
        private String lastName;
        
        @Column(name = "FIRST_NM")
        private String firstName;
        
        @Column(name = "MDL_INITIAL")
        private String mdlInitial;
        

        public long getNameId() {
                return nameId;
        }

        public void setNameId(long nameId) {
                this.nameId = nameId;
        }
        
        public String getLastName() {
                return lastName;
        }

        public void setLastName(String lastName) {
                this.lastName = lastName;
        }
        
        public String getFirstName() {
                return firstName;
        }

        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }
        
        public String getMdlInitial() {
                return mdlInitial;
        }

        public void setMdlInitial(String mdlInitial) {
                this.mdlInitial = mdlInitial;
        }

        public Application getApplication() {
                return application;
        }

        public void setApplication(Application application) {
                this.application = application;
        }

}


Thanks,
JP

-- 
View this message in context: 
http://n2.nabble.com/Optimistic-locking-exception-while-performing-a-delete-tp2566822p2570758.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to