users@glassfish.java.net

toplink QueryException with a constructor expression Spring 2.5, JPA, JSF a

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Dec 2009 11:07:27 PST

Hello together,

I have a Spring 2.5 web application with JPA and JSF running on Glassfish-v2.1 and a PostgreSql database. Everything is running perfect on localhost and developer Glassfish but on a real enterprise Glassfish Server I'm getting the following error:
Code:

javax.servlet.ServletException: #{mybean.search}: Exception [TOPLINK-6137] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.QueryException
Exception Description: An Exception was thrown while executing a ReportQuery with a constructor expression: java.lang.NoSuchMethodException: com.company.CustomerDetail.<init>(com.company.db.Customer)
Query: ReportQuery(com.company.db.Customer)

after triggering the JPA query:
Code:

Query q = em.createQuery("SELECT NEW com.company.util.CustomerDetail(c) FROM Customer c");
    List<CustomerDetail> result = q.getResultList();

persistence.xml
Code:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

   <persistence-unit name="MyPU" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/company</jta-data-source>
    <properties/>
  </persistence-unit>
</persistence>

Customer class looks like this
Code:

package com.company.db.Customer;

import ...

@Entity
@Table(name = "Customer")
public class Customer implements java.io.Serializable {

// private static final long serialVersionUID = 1L;

        private String username;
        private String password;
        
        public Customer() {
        }

        public Customer(String username, String password) {
                this.username = username;
                this.password = password;
        }

        @Id
        @Column(name = "USERNAME", nullable = false, length = 50)
        public String getUsername() {
                return this.username;
        }

        public void setUsername(String username) {
                this.username = username;
        }

        @Column(name = "PASSWORD", nullable = false, length = 50)
        public String getPassword() {
                return this.password;
        }

        public void setPassword(String password) {
                this.password = password;
        }
...
}

and CustomerDetail class
Code:

package com.company.util.CustomerDetail;

import ...

public class CustomerDetail implements java.io.Serializable {

        private Customer user;
        private String password;
        private String username;
        
        public CustomerDetail() {
        }

        public CustomerDetail(Customer user) {
              this.user=user
        }
setter...
getter...
and some methods...

I've tried eveything I got in the web but nothing could make the TopLink Error disappear.
On both machines are the same java version ("1.6.0_17") and Glassfish-v2.1 version running.
The only difference between the two computers is that the localhost pc has a 64-bit processor.


Any suggestions?
Thank you.
[Message sent by forum member 'banifou' ]

http://forums.java.net/jive/thread.jspa?messageID=375827