Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem persisting TimestampTZ with JPA
Problem persisting TimestampTZ with JPA [message #737095] Fri, 14 October 2011 12:52 Go to previous message
Jeremy Purdy is currently offline Jeremy Purdy
Messages: 7
Registered: October 2011
Junior Member
Versions
Eclipselink 2.1
Oracle 10.2.0.4
Tomcat 5.5.26

Using JPA, I am attempting to persist a java.util.Calendar object to an Oracle Timestamp With Time Zone column. From what I have read, Eclipselink is supposed to just handle this for Oracle DB.

However, an attempt at a direct mapping:

@Entity
@Table(name="TIMESTAMP_TZ_TEST")
public class TimestampTzTest {
	@Id
	private Long id;
	@Column(name="TIME")
	private Calendar time;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Calendar getTime() {
		return time;
	}
	
	public void setTime(Calendar time) {
		this.time = time;
	}
}


fails during startup because
The attribute [time] from the entity class [class eg.model.TimestampTzTest] does not specify a temporal type.


Next, I try using a TypeConverter

	@Column(name="TIME")
	@Convert("timestamptz")
	@TypeConverter(name="timestamptz", dataType=TIMESTAMPTZ.class)
	private Calendar time;


This results in an error during execution:
Caused by: java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.DelegatingCallableStatement cannot be cast to oracle.jdbc.OracleCallableStatement
	at oracle.sql.TRANSDUMP.getTransitions(TRANSDUMP.java:42)
	at oracle.sql.TIMEZONETAB.updateTable(TIMEZONETAB.java:456)
	at oracle.sql.TIMESTAMPTZ.toTimestamp(TIMESTAMPTZ.java:571)
	at oracle.sql.TIMESTAMPTZ.timestampValue(TIMESTAMPTZ.java:731)
	at org.eclipse.persistence.platform.database.oracle.Oracle9Platform.getTIMESTAMPTZFromResultSet(Oracle9Platform.java:192)


From what I have found during search, this appears to be caused by the Tomcat connection pool not returning the underlying OracleCallableStatement.

I have not been able to find a solution to this problem. Can someone please guide me?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:what maven artefact for (DynamicJaxbContext with xsd) ...jaxb.dynamic.metadata.SchemaMetadata
Next Topic:Controlling column order when creating tables with ddl-generation
Goto Forum:
  


Current Time: Sat May 18 03:46:52 EDT 2013

Powered by FUDForum. Page generated in 0.01706 seconds