I have my code below, can somebody point out what is exactly causing the one to one mapped entity 'SubscriberServiceConfig ' not to be lazily fetched. 1)Class 'A'
@Entity @Table(name = "SERVICE") @org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) public class Service implements Serializable { private static final long serialVersionUID = -5345322513746418441L;
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EDI_SEQ") @SequenceGenerator(name = "EDI_SEQ", sequenceName = "EDI_SEQ", allocationSize = 1) @Column(name = "SERVICE_ID", nullable = false, unique = true) private Long id;
@OneToMany(mappedBy = "service") @Cascade( { CascadeType.ALL, CascadeType.DELETE_ORPHAN }) @LazyCollection(LazyCollectionOption.TRUE) private List<SubscriberServiceReltn> subscrServiceReltns = new ArrayList<SubscriberServiceReltn>(); }
2) Class B @Entity @Table(name = "SUBSCRIBER_SERVICE_RELTN") @org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) public class SubscriberServiceReltn implements Serializable {
private static final long serialVersionUID = 2843713013040198985L;
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EDI_SEQ") @SequenceGenerator(name = "EDI_SEQ", sequenceName = "EDI_SEQ", allocationSize = 1) @Column(name = "SUBSCRIBER_SERVICE_RELTN_ID", nullable = false, unique = true) private Long id;
@ManyToOne(targetEntity = com.cerner.edi.dep.subscriber.entity.Subscriber.class, fetch = FetchType.LAZY) @JoinColumn(name = "SUBSCRIBER_ID", insertable = true, updatable = false, nullable = false) private Subscriber subscriber;
@ManyToOne(targetEntity = com.cerner.edi.dep.subscriber.entity.Service.class, fetch = FetchType.LAZY) @JoinColumn(name = "SERVICE_ID", insertable = true, updatable = false, nullable = false) private Service service;
@OneToOne(mappedBy = "subscriberServiceReltn", fetch = FetchType.LAZY) @Cascade( { CascadeType.DELETE_ORPHAN, CascadeType.ALL }) private SubscriberServiceConfig subscriberServiceConfig; }
c) Class 'C' @Entity @Table(name = "SUBSCRIBER_SERVICE_CONFIG") @org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) public class SubscriberServiceConfig implements Serializable {
private static final long serialVersionUID = 6351762912651912853L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EDI_SEQ") @SequenceGenerator(name = "EDI_SEQ", sequenceName = "EDI_SEQ", allocationSize = 1) @Column(name = "SUBSCRIBER_SERVICE_CONFIG_ID", nullable = false, unique = true) private Long id;
@OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "SUBSCRIBER_SERVICE_RELTN_ID") private SubscriberServiceReltn subscriberServiceReltn; }
|