openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scherer, Annette" <Annette.Sche...@huk-coburg.de>
Subject Persist pojo
Date Thu, 08 May 2008 13:53:25 GMT
Hi,

I want to persist a pojo to Database per JPA. It fails with following
message 
<openjpa-1.0.2-r420667:627158 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: DB2 SQL error:
SQLCODE: -530, SQLSTATE: 23503

Thank you for valuable Information


Here is the relevant coding:

Annotated Classes:

public class DomainAssociation implements Serializable {
	
	@Column(name="DA_NAME", length=50)
	@Id private String name;

	@Column(name="DA_BEMERKUNG", length=200)
	private String comment;
	
	@OneToMany(mappedBy="domainAssociation", cascade=CascadeType.ALL
, fetch=FetchType.EAGER)
	private List<Domain> domains;


public class Domain implements Serializable {
	
	@Column(name="DOMAIN_NAME", length=50)
	@Id private String name;
	
	@Column(name="DOMAIN_VERWENDUNG", length=5)
	private String use;
	
	@Column(name="DOMAIN_TYP", length=10)
	private String type;
	
	@Column(name="DOMAIN_BEMERKUNG", length=200)
	private String comment;
	
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
	@JoinColumn(name="DA_NAME")
	private DomainAssociation domainAssociation;
	
	@OneToMany(mappedBy="domain", cascade=CascadeType.ALL ,
fetch=FetchType.EAGER)
	private List<DomainValue> domainValues;



Persistence.xml

<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="InitializeSourceDomaenenDB">
		<provider>
	
org.apache.openjpa.persistence.PersistenceProviderImpl
		</provider>
	
<jta-data-source>java:comp/env/jdbc/domaenendb</jta-data-source>
		<properties>
			<property name="openjpa.TransactionMode"
value="managed"/>
    		<property name="openjpa.ConnectionFactoryMode"
value="managed"/>
    		<property name="openjpa.jdbc.DBDictionary" value="db2"/>
    		<property name="openjpa.jdbc.Schema" value="XX"/>
		</properties>
	</persistence-unit>
</persistence>



Executed code

	DomainAssociation da = new DomainAssociation();
	da.setName("da");
	da.setComment("comment");
				
	Domain dom1 = new Domain();
	dom1.setName("domain1");
	dom1.setUse("PRES");
	dom1.setType("String");
	dom1.setComment("comment");
	dom1.setDomainAssociation(da);
				
	Domain dom2 = new Domain();
	dom2.setName("domain2");
	dom2.setUse("MOD");
	dom2.setType("String");
	dom2.setComment("comment");
	dom2.setDomainAssociation(da);
		
	List<Domain> domains = new Vector<Domain>();
	domains.add(dom1);
	domains.add(dom2);
	da.setDomains(domains);
			
	this.getEm().persist(da);	




Thrown Exception:


<openjpa-1.0.2-r420667:627158 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: DB2 SQL error:
SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: T7.TADOMAIN.FK_01 {prepstmnt
1699374410 INSERT INTO T7.TADOMAIN (DOMAIN_NAME, DOMAIN_BEMERKUNG,
DOMAIN_TYP, DOMAIN_VERWENDUNG, DA_NAME) VALUES (?, ?, ?, ?, ?)
[params=(String) domain2, (String) comment, (String) String, (String)
MOD, (String) da]} [code=-530, state=23503]SQLCA OUTPUT[Errp=SQLRI079,
Errd=-2145779603, 0, 0, 0, -100, 0]




Dear greetings 
Annette Scherer


Mime
View raw message