Version 2.2.7 build 7/8 issue


Hi all,

I have problems with builds 7 and 8 when trying to sort entities with mappedBy and my own method in query. This query "SELECT c FROM Customer c order by c.getNormalizedName()" returns List with null objects!

With builds 6 and 5 works it correctly. Removing mappedBy from @OneToOne(mappedBy = "address") also helps.

My code:

public class JavaApplication {
    public static void main(String[] args) {
        EntityManagerFactory emf =
        EntityManager em = emf.createEntityManager();

        Customer c = new Customer("1");
        Address a = new Address();

        Query query = em.createQuery(
            "SELECT c FROM Customer c order by c.getNormalizedName()");
        List resultList = query.getResultList();


public class Customer implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id @GeneratedValue
    private Long id;
    private String name;
    @OneToOne(cascade= CascadeType.ALL, fetch= FetchType.EAGER, optional=false)
    private Address address;
    public Customer(String name){ = name;

    public Address getAddress() {
        return address;

    public void setAddress(Address address) {
        this.address = address;
    public String getNormalizedName(){
        return Normalizer.normalize(name, Normalizer.Form.NFD);
    public String toString(){
        return name;

public class Address implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id @GeneratedValue
    private Long id;
    @OneToOne(mappedBy = "address")
    private Customer customer;

    public Customer getCustomer() {
        return customer;

    public void setCustomer(Customer customer) {
        this.customer = customer;

    public Long getId() {
        return id;

    public void setId(Long id) { = id;

This is indeed a regression bug. Your code should work again with build 2.2.7_09.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login