Hi all
My question is if we can persist interfaces instead of pure classes as entities
without using OpenJPA features. Currently with a test case I encountered the
persistence exception however the OpenJPA logs shows that it is going to insert
data but with wrong value !!!
9233 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> executing
prepstmnt 14116828 SELECT t0.NAME FROM GL1TEST_INTERFACE t0 WHERE t0.ID = ?
[params=(long) 12]
9280 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> [47 ms] spent
9343 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> executing
prepstmnt 32459120 INSERT INTO GL1TEST_TX (ID, NAME, INTERFACE_ID) VALUES (?,
?, ?) [params=(long) 12, (String) hello, (String)
com.kishware.core.gl.data.InterfaceImpl:com.kishware.core.gl.data.In...]
9374 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> [31 ms] spent
9374 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> executing
prepstmnt 7839182 INSERT INTO GL1TEST_INTERFACE (ID, NAME) VALUES (?, ?)
[params=(long) 12, (String) interface]
9374 pu-cm TRACE [main] openjpa.jdbc.SQL - <t 14104547, conn 0> [0 ms] spent
as you can see in first insert statement INTERFACE_ID should be a long value
but OpenJPA put a String value to be inserted and this ends up in an oracle
error with message "invalid number"
Here is the entities definition:
public class TestTx {
@Id
@Column(name="ID")
private Long id;
@Column(name="NAME")
private String name;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "INTERFACE_ID")
private IInterface iInterface;
//getters and setters....
}
@Entity
@Table(name = "GL1TEST_INTERFACE")
public class InterfaceImpl implements IInterface {
@Id
@Column(name = "ID")
private Long id;
@Column(name = "NAME")
private String name;
//getters and setters....
}
Thanks
--
View this message in context:
http://n2.nabble.com/Persisting-interface-tp2587940p2587940.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.