openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hm (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OPENJPA-2448) java.lang.Integer cannot be cast to java.lang.Long
Date Wed, 30 Oct 2013 11:24:25 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808979#comment-13808979
] 

hm edited comment on OPENJPA-2448 at 10/30/13 11:23 AM:
--------------------------------------------------------

we don't change any things our environment
we have many query and +300 entities/tables in our database and this error occurred only in
SESSION table

the query is:
 select us from UserSession as us where us.sessionId= ?1

Exception Cause:
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
	at com.core90.da.UserSession.pcReplaceField(UserSession.java)
	at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3025)
	at org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(StateManagerImpl.java:2457)
	at org.apache.openjpa.kernel.StateManagerImpl.storeField(StateManagerImpl.java:2553)
	at org.apache.openjpa.kernel.StateManagerImpl.storeField(StateManagerImpl.java:788)
	at org.apache.openjpa.kernel.StateManagerImpl.store(StateManagerImpl.java:784)
	at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:188)
	at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:813)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1060)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1012)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)




was (Author: hmmahboobi@gmail.com):
we don't change any things our environment
we have many query and +300 entities/tables in our database and this error occurred only in
SESSION table

the query is:
 select us from UserSession as us where us.id = ?1

Exception Cause:
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
	at com.core90.da.UserSession.pcReplaceField(UserSession.java)
	at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3025)
	at org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(StateManagerImpl.java:2457)
	at org.apache.openjpa.kernel.StateManagerImpl.storeField(StateManagerImpl.java:2553)
	at org.apache.openjpa.kernel.StateManagerImpl.storeField(StateManagerImpl.java:788)
	at org.apache.openjpa.kernel.StateManagerImpl.store(StateManagerImpl.java:784)
	at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:188)
	at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:813)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1060)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1012)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)



> java.lang.Integer cannot be cast to java.lang.Long
> --------------------------------------------------
>
>                 Key: OPENJPA-2448
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2448
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.2.2
>         Environment: SLES 11
> JRE 6 U15
> Glassfish 2.1.1
>            Reporter: hm
>            Priority: Critical
>
> We have following error without any changes on application or other related liberalizes.
> <openjpa-1.2.2-r422266:898935 nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
java.lang.Integer cannot be cast to java.lang.Long
> 	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:894)
> 	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:793)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:986)
> 	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2413)
> 	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:272)
> 	at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
> 	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1294)
> 	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1221)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:775)
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:533)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:252)
> 	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:317)
> this is my persistence.xml file:
> <persistence 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"
> 	version="1.0">
> 	<persistence-unit name="pu-core90" transaction-type="JTA">
> 		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> 		<jta-data-source>jdbc/coreDS</jta-data-source>
> 	<mapping-file>META-INF/orm.xml</mapping-file>
>     	...
> 	<class>com.core90.da.UserSession</class>
> 	...
>     	<properties>
> 	            <property name="openjpa.jdbc.DBDictionary"
>                   value="oracle(batchLimit=0,maxEmbeddedBlobSize=-1,maxEmbeddedClobSize=-1)"
/>
>            
>             <property name="openjpa.jdbc.SynchronizeMappings"
>     				value="buildSchema(foreignKeys=true,schemaAction='none')"/>
>             <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
>             <property name="openjpa.RestoreState" value="all"/>
>            
> 	    <property name="openjpa.TransactionMode" value="managed" />
>             <property name="openjpa.ManagedRuntime"  value="jndi(TransactionManagerName=java:appserver/TransactionManager)"
/>
>             <property name="openjpa.DataCache" value="false"/>
>             <property name="openjpa.RemoteCommitProvider" value="sjvm" />
>             <property name="openjpa.IgnoreChanges" value="true" />
>             
>     	</properties>
>     
>   </persistence-unit>
>  
> </persistence>
> this is my entity class:
> @Entity
> @Table(name="SESSION", uniqueConstraints={@javax.persistence.UniqueConstraint(columnNames={"SESUID"})})
> @DataCache(enabled=false)
> public class UserSession {
>   @Id
>   @Column(name="ID")
>    private Long id;
>   @Column(name="CRTTIM")
>   @Temporal(TemporalType.TIMESTAMP)
>   private Date loginDate;
>   @Column(name="TIMOUT")
>   private Long timeout;
>   @Column(name="SESUID", unique=true)
>   private String sessionId;
>   @Column(name="LSTACCSTIM")
>   @Temporal(TemporalType.TIMESTAMP)
>   private Date lastAccessTime;
>   @Column(name="CLNTIP")
>   private String clientIP;
> ...
> }
> we have old version of this entity that located in another class and there is a bit difference
in timeout variable(data type is Integer). is this difference lead to this issue? please consider
that there isn't any any scenario in application that calls UserSessionOld class.
> @Entity
> @Table(name="SESSION", uniqueConstraints={@javax.persistence.UniqueConstraint(columnNames={"SESUID"})})
> @DataCache(enabled=false)
> public class UserSessionOld {
>   @Id
>   @Column(name="ID")
>    private Long id;
>   @Column(name="CRTTIM")
>   @Temporal(TemporalType.TIMESTAMP)
>   private Date loginDate;
>   @Column(name="TIMOUT")
>   private Integer timeout;
>   @Column(name="SESUID", unique=true)
>   private String sessionId;
>   @Column(name="LSTACCSTIM")
>   @Temporal(TemporalType.TIMESTAMP)
>   private Date lastAccessTime;
>   @Column(name="CLNTIP")
>   private String clientIP;
> ...
> }



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message