parent « Property « JPA Q&A





1. Filter collection by parent property    forum.hibernate.org

@Entity public class Parent{ @Column(name="id") public Integer id; @Column(name="surname") public String surname; @ManyToMany(fetch=FetchType.EAGER) @JoinTable( name="parents_children", joinColumns = @JoinColumn(name = "parent_id", referencedColumnName="id"), inverseJoinColumns = @JoinColumn(name = ...

2. Persisting properties of parent class with annotation    forum.hibernate.org

package com.examscam.mappings; import javax.persistence.*; @Entity public class Ancestor { private Long id; private String nationality; @Id @GeneratedValue public Long getId() {return id;} public void setId(Long id) {this.id = id;} public String getNationality() {return nationality;} public void setNationality(String nationality) { this.nationality = ...

3. lazyInitializationException when accessing a parent property    forum.hibernate.org

Regular Joined: Tue Feb 19, 2008 6:05 pm Posts: 77 I am getting a lazyInitializationException whenever I access a child objects' parentObject property defined using a many-to-one relationship in the child mapping file (see childObj.hbm.xml). I access my child object using a DAO method (see the DAO below) which uses the session.get(child.class,childId) method to return my childObj object. I am able ...