openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vorburger" <mvorbur...@odyssey-group.com>
Subject RE: Persist pojo
Date Thu, 08 May 2008 13:58:57 GMT
How about you check the DB2 documentation about what SQLCODE: -530,
SQLSTATE: 23503 means?

Sometimes it helps to try on another DB, e.g. an embedded Derby, for
clarity.


-----Original Message-----
From: Scherer, Annette [mailto:Annette.Scherer@huk-coburg.de] 
Sent: jeudi, 8. mai 2008 15:53
To: users@openjpa.apache.org
Subject: Persist pojo

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


____________________________________________________________

 This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
 Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
 Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
 An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
 If you have received this email in error, please notify the sender immediately
  and delete the original.

Mime
View raw message