Hallo,
wenn ich aus einer Tabelle der Wert von primäre Schlüssel über ein VO Objekt haben will, bekomme ich null Wert zurück.
PK wird richtig automatisch mit Sequence vom Hibernate3 vergeben wenn ich es mit iSQL*Plus anschaue.
Datenbank Server ist Oracle 10g.
Warum kriege ich für die ID null zurück?
Hier ist die Hibernate Konfiguration:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Attention: Generated code! Do not modify by hand!
Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none">
<class name="hu.unitis.flexsign.signmanagement.SignManagerImpl" table="SIGN_MANAGER" dynamic-insert="false" dynamic-update="false">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="NUMBER(19)"/>
<generator class="native">
</generator>
</id>
<property name="fileName" type="java.lang.String">
<column name="FILE_NAME" not-null="false" unique="false" sql-type="VARCHAR2(255)"/>
</property>
<property name="filePath" type="java.lang.String">
<column name="FILE_PATH" not-null="false" unique="false" sql-type="VARCHAR2(255)"/>
</property>
<property name="waitingForSignature" type="int">
<column name="WAITING_FOR_SIGNATURE" not-null="false" unique="false" sql-type="NUMBER(10)"/>
</property>
</class>
</hibernate-mapping>
Hier ist der Code:
Code:
SignManagerVO[] smColl = smServ.findSigned(1);
for(int i=0; i<smColl.length; i++){
System.out.println("Updateing... " + smColl[i].getID() + " / " + smColl[i].getFileName() + " / " + smColl[i].getFilePath());
smColl[i].setFileName("testing.pdf");
smColl[i].setFilePath("c:\\sign\\temp");
smServ.updateSignManager(smColl[i]);
}
Server console:
Code:
09:33:35,100 INFO [STDOUT] Hibernate: select hibernate_sequence.nextval from dual
09:33:35,366 INFO [STDOUT] Hibernate: insert into SIGN_MANAGER (FILE_NAME, FILE_PATH, WAITING_FOR_SIGNATURE, ID) values (?, ?, ?, ?)
09:33:35,413 INFO [STDOUT] Hibernate: select this_.ID as ID2_0_, this_.FILE_NAME as FILE2_2_0_, this_.FILE_PATH as FILE3_2_0_, this_.WAITING_FOR_SIGNATURE as WAITING4_2_0_ from SIGN_MANAGER this_ where this_.WAITING_FOR_SIGNATURE=?
09:33:35,444 INFO [STDOUT] Updateing... null / test.pdf / e:\
09:33:35,522 ERROR [LogInterceptor] EJBException in method: public abstract hu.unitis.flexsign.signmanagement.SignManagerVO hu.unitis.flexsign.signmanagement.ejb.SignManagementService.updateSignManager(hu.unitis.flexsign.signmanagement.SignManagerVO) throws java.rmi.RemoteException, causedBy:
java.lang.IllegalArgumentException: SignManager.load - 'id' can not be null
at hu.unitis.flexsign.signmanagement.SignManagerDaoBase.load(SignManagerDaoBase.java:28)
at hu.unitis.flexsign.signmanagement.SignManagerDaoBase.load(SignManagerDaoBase.java:40)
at hu.unitis.flexsign.signmanagement.SignManagerDaoImpl.loadSignManagerFromSignManagerVO(SignManagerDaoImpl.java:60)
at hu.unitis.flexsign.signmanagement.SignManagerDaoImpl.signManagerVOToEntity(SignManagerDaoImpl.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Danke für Eure Hilfe!