Hi,
    I still could not reproduce the NPE problem using your entities. The 
following is the url for join fetch. 


http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/jpa_overview_query.html#jpa_overview_join_fetch






----- Original Message ----
From: Zhanming Qi <[email protected]>
To: [email protected]
Sent: Thu, June 3, 2010 4:19:10 AM
Subject: Re: openjpa-2.0 how join fetch work?


Hi,
Here is my POJOs.

Corporation is:

@Entity
@Table(name = "CORPORATION")
public class Corporation implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID", nullable = false)
    private int id;
    
    @Column(name = "CORPORATION_NAME")
    private String name;

    @OneToMany(mappedBy = "corporation", fetch = FetchType.LAZY)
    private Set<Division> divisions;
    
    @Version
    private int version;
    
    public Corporation() {
        
    }

getter and setter
}

Division is:

@Entity
@Table(name = "DIVISION")
public class Division implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID", nullable = false)
    private long id;
    
    private String name;
    
    private long mumber;
    
    @Embedded
    private Address address;
    
    @ManyToOne
    @JoinColumn(name = "CORPORATION_ID")
    private Corporation corporation;
    
    @OneToMany(mappedBy = "division")
    private Set<Department> departments;
    
    @Version
    private int version;
    
    public Division() {
    }
getter and setter
}

Thanks.
Zhanming
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/openjpa-2-0-how-join-fetch-work-tp5121731p5134729.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



      

Reply via email to