-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: getID liefert null zurück
PostPosted: Wed Jan 23, 2008 10:44 am 
Newbie

Joined: Wed Jan 23, 2008 8:36 am
Posts: 4
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!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 5:25 am 
Newbie

Joined: Wed Jan 23, 2008 8:36 am
Posts: 4
Hallo,

ich habe die ID von VO Objekt neu gesetzt dann hat update wirklich funktioniert.
Habe noch ähnliche Topics gefunden wo die Lösung war, so dass man Multiplicity von ID auf [0..1] setzen sollte, hat es aber bei mir nicht geholfen.

LG


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.