|
|
Spring 2.5, JPA, JSF app AND toplink QueryException
pany.util.CustomerDetail.lt;initgt;(com.company.db.Customer)
Query: ReportQuery(com.company.db.Customer)
after triggering the JPA query:
Code:
Query q = em.createQuery(quot;SELECT NEW com.company.util.CustomerDetail(c) FROM Customer cquot;); Listlt;CustomerDetailgt; result = q.getResultList();
applicationContext.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;beans xmlns=quot;schema/beansquot; xmlns:xsi=quot;2001/XMLSchema-instancequot; xmlns:context=quot;schema/contextquot; xmlns:tx=quot;schema/txquot; xmlns:p=quot;schema/pquot; xsi:schemaLocation=quot; schema/beans schema/beans/spring-beans-2.5.xsd schema/context schema/context/spring-context-2.5.xsd schema/tx schema/tx/spring-tx-2.5.xsdquot;gt;
lt;tx:annotation-driven /gt; lt;context:annotation-config/gt; lt;bean id=quot;entityManagerFactoryquot; class=quot;org..orm.jpa.LocalContainerEntityManagerFactoryBeanquot; p:dataSource-ref=quot;dataSourcequot; gt; lt;property name=quot;jpaVendorAdapterquot;gt;lt;bean class=quot;org..orm.jpa.vendor.TopLinkJpaVendorAdapterquot; p:databasePlatform=quot;${jpa.databasePlatform}quot; p:showSql=quot;${jpa.showSql}quot; p:database=quot;${jpa.database}quot; /gt; lt;/propertygt; lt;property name=quot;loadTimeWeaverquot; gt;lt;bean class=quot;org..instrument.classloading.glassfish.GlassFishLoadTimeWeaverquot;/gt; lt;/propertygt; lt;/beangt;
lt;bean id=quot;dataSourcequot; class=quot;org..jdbc.datasource.DriverManagerDataSourcequot; p:driverClassName=quot;${jdbc.driverClassName}quot; p:ucl=quot;${jdbc.ucl}quot; p:username=quot;${jdbc.username}quot; p:password=quot;${jdbc.password}quot; /gt;
lt;bean id=quot;propertyConfigurerquot; class=quot;org..beans.factory.config.PropertyPlaceholderConfigurerquot; p:location=quot;/WEB-INF/config/jdbc.propertiesquot; /gt; lt;bean class=quot;org..dao.annotation.PersistenceExceptionTranslationPostProcessorquot;/gt; lt;bean class=quot;org..orm.jpa.support.PersistenceAnnotationBeanPostProcessorquot;/gt;
persistence.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;persistence version=quot;1.0quot; xmlns=quot;xml/ns/persistencequot;
xmlns:xsi=quot;2001/XMLSchema-instancequot;
xsi:schemaLocation=quot;xml/ns/persistence xml/ns/persistence/persistence_1_0.xsdquot;gt;
lt;persistence-unit name=quot;MyPUquot; transaction-type=quot;JTAquot;gt; lt;providergt;oracle.toplink.essentials.PersistenceProviderlt;/providergt; lt;jta-data-sourcegt;jdbc/companylt;/jta-data-sourcegt; lt;properties/gt; lt;/persistence-unitgt;
lt;/persistencegt;
Customer class looks like this
Code:
package com.company.db.Customer;
import ...
@Entity
@Table(name = quot;Customerquot;)
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 = quot;USERNAMEquot;, nullable = false, length = 50)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = quot ASSWORDquot;, 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 tried different configurations but the TopLink Error above still remains on the enterprise Glassfish Server.
Any suggestions?
Thank you.
Further informations:
on both machines are the same java version (quot;1.6.0_17quot;) and Glassfish-v2.1 version running.
The only difference between the two computers is that the localhost pc has a 64-bit processor.
Does anybody have an idea?
I tried everything I got in the web like the suggestions in this Thread showthread.php?t=66216
but nothing could make the problem solved.
Why should the same app works fine on a Glassfish (developer mode) and not on another enterprise Glassfish?
Please help
I tried with EclipseLink, same problem.
I finally managed to get Hibernate as JPA provider in Glassfish and Tataa the problem disappeared! |
|