openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hm (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2448) java.lang.Integer cannot be cast to java.lang.Long
Date Tue, 29 Oct 2013 15:18:30 GMT
hm created OPENJPA-2448:
---------------------------

             Summary: 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