-->
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.  [ 12 posts ] 
Author Message
 Post subject: NullPointerException when flushing after save?
PostPosted: Sat Mar 25, 2006 4:54 pm 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
I get the following exception when trying to flush after I have called save..:

Code:
java.lang.NullPointerException
   at org.hibernate.engine.EntityEntry.getLoadedValue(EntityEntry.java:141)
   at org.hibernate.type.CollectionType.getKeyOfOwner(CollectionType.java:302)
   at org.hibernate.engine.Collections.processReachableCollection(Collections.java:137)
   at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
   at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104)
   at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64)
   at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:198)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
   at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:815)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
   at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:813)
   at no.havleik.dt.DAO.BaseHibernateDAO.saveOrUpdate(BaseHibernateDAO.java:34)
   at no.havleik.dt.services.OrderServiceImpl.saveFellesOrder(OrderServiceImpl.java:197)
   at no.havleik.dt.services.OrderServiceImpl$$FastClassByCGLIB$$cb9573dc.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
   at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.interceptor.CustomizableTraceInterceptor.invokeUnderTrace(CustomizableTraceInterceptor.java:269)
   at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:111)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
   at no.havleik.dt.services.OrderServiceImpl$$EnhancerByCGLIB$$1e98bbc5.saveFellesOrder(<generated>)
   at no.havleik.dt.jsf.order.OrderBean.save(OrderBean.java:68)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
   at javax.faces.component.UICommand.broadcast(UICommand.java:312)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:285)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at no.havleik.dt.security.AuthFilter.doFilter(AuthFilter.java:83)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)



And this is the log from Hibernate, during flush..:

Code:
25.03.2006 21:50:39,278 DEBUG AbstractFlushingEventListener - flushing session
25.03.2006 21:50:39,278 DEBUG AbstractFlushingEventListener - processing flush-time cascades
25.03.2006 21:50:39,279 DEBUG Cascades        - processing cascade ACTION_SAVE_UPDATE for: no.havleik.dt.model.OrdreNew
25.03.2006 21:50:39,279 DEBUG Cascades        - cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.leveringer
25.03.2006 21:50:39,279 DEBUG Cascades        - done cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.leveringer
25.03.2006 21:50:39,280 DEBUG Cascades        - cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.istikks
25.03.2006 21:50:39,280 DEBUG Cascades        - cascading to saveOrUpdate: no.havleik.dt.model.Istikk
25.03.2006 21:50:39,280 DEBUG AbstractSaveEventListener - persistent instance of: no.havleik.dt.model.Istikk
25.03.2006 21:50:39,281 DEBUG DefaultSaveOrUpdateEventListener - ignoring persistent instance
25.03.2006 21:50:39,281 DEBUG DefaultSaveOrUpdateEventListener - object already associated with session: [no.havleik.dt.model.Istikk#component[id,ordreid]{ordreid=6237, id=0}]
25.03.2006 21:50:39,281 DEBUG Cascades        - done cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.istikks
25.03.2006 21:50:39,282 DEBUG Cascades        - cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.logDistributionFramgangDefaults
25.03.2006 21:50:39,282 DEBUG Cascades        - done cascade ACTION_SAVE_UPDATE for collection: no.havleik.dt.model.OrdreNew.logDistributionFramgangDefaults
25.03.2006 21:50:39,282 DEBUG Cascades        - done processing cascade ACTION_SAVE_UPDATE for: no.havleik.dt.model.OrdreNew
25.03.2006 21:50:39,282 DEBUG AbstractFlushingEventListener - dirty checking collections
25.03.2006 21:50:39,283 DEBUG AbstractFlushingEventListener - Flushing entities and processing referenced collections
25.03.2006 21:50:39,288 DEBUG DefaultFlushEntityEventListener - Updating entity: [no.havleik.dt.model.OrdreNew#6237]
25.03.2006 21:50:39,289 DEBUG Versioning      - Incrementing: 2004-12-04 10:47:32.958694 to 2006-03-25 21:50:39.288
25.03.2006 21:50:39,311 DEBUG Collections     - Collection found: [no.havleik.dt.model.OrdreNew.leveringer#6237], was: [no.havleik.dt.model.OrdreNew.leveringer#6237] (initialized)
25.03.2006 21:50:39,312 DEBUG Collections     - Collection found: [no.havleik.dt.model.OrdreNew.istikks#6237], was: [no.havleik.dt.model.OrdreNew.istikks#6237] (initialized)
25.03.2006 21:50:41,790 DEBUG JDBCTransaction - rollback
25.03.2006 21:50:41,790 DEBUG JDBCContext     - before transaction completion
25.03.2006 21:50:41,790 DEBUG SessionImpl     - before transaction completion
25.03.2006 21:50:41,790 DEBUG JDBCTransaction - re-enabling autocommit
25.03.2006 21:50:41,790 DEBUG JDBCTransaction - rolled back JDBC Connection
25.03.2006 21:50:41,790 DEBUG JDBCContext     - after transaction completion
25.03.2006 21:50:41,790 DEBUG SessionImpl     - after transaction completion
25.03.2006 21:50:41,790 DEBUG SessionImpl     - closing session
25.03.2006 21:50:41,790 DEBUG ConnectionManager - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
25.03.2006 21:50:41,790 DEBUG JDBCContext     - after transaction completion
25.03.2006 21:50:41,790 DEBUG SessionImpl     - after transaction completion




Can anyone shed a light?


Regards,

BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 1:48 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I don't know what causes it (other than the obvious: there's a null persister being used), but I see that that bit of the code has been radically changed between 3.0.5 (I presume that's what you're using, the trace line numbers match up) and 3.1.x. If you're able to, upgrade to 3.1 or 3.2 and see if that's one of the bug fixes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 1:50 am 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
Well, it depends...

I am using Spring 1.2.7, can I upgrade Hibernate then or should I still use the Hibernate version that comes with Spring?


BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 4:22 am 
Regular
Regular

Joined: Tue Nov 29, 2005 12:31 pm
Posts: 75
Hi,

Post your mappings.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 1:00 pm 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
Actually, I have solved this problem..

I had a list association where I used a key with both column and property-ref attr, but I had to use column and foreign key instead....


BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 5:47 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Are you sure? property-ref and foreign-key are very different attributes, you can't just swap them to make a problem go away. foreign-key is used by schema generators to create foreign keys (the actual relationships, not columns involved in them); property-ref is used to tell runtime hibernate what columns are involved in foreign keys. The foreign-key attribute does not affect runtime hibernate at all.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 4:51 pm 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
Well, you are absolutely correct... foreign key does not work...
So my question remains, how do I solve this, I want to use property-ref, because the id in my collection is not connected to the primary key of the parent...

BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 5:13 pm 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
btw, my mapping look lik this...:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="no.havleik.dt.model">
    <class name="OrdreNew" table="ordrenew" schema="public">
        <cache usage="read-write" />
        <id name="id" type="java.lang.Long">
            <column name="id" />
            <generator class="sequence">
              <param name="sequence">ordrenewid_seq</param>
            </generator>
        </id>

        <version
            name="updated"
            column="updated"
            type="timestamp"
            unsaved-value="null"
        />

        <property name="productid" type="java.lang.Integer">
            <column name="productid" />
        </property>
        <property name="avisdato" type="date">
            <column name="avisdato" length="4" />
        </property>
        <property name="sidetall1" type="java.lang.Integer">
            <column name="sidetall_1" />
        </property>
        <property name="sidetall2" type="java.lang.Integer">
            <column name="sidetall_2" />
        </property>
        <property name="sidetall3" type="java.lang.Integer">
            <column name="sidetall_3" />
        </property>
        <property name="sidetall4" type="java.lang.Integer">
            <column name="sidetall_4" />
        </property>
        <property name="paperid1" type="java.lang.Integer">
            <column name="paperid_1" />
        </property>
        <property name="paperid2" type="java.lang.Integer">
            <column name="paperid_2" />
        </property>
        <property name="paperid3" type="java.lang.Integer">
            <column name="paperid_3" />
        </property>
        <property name="paperid4" type="java.lang.Integer">
            <column name="paperid_4" />
        </property>
        <property name="trykkedato" type="date">
            <column name="trykkedato" length="4" />
        </property>
        <property name="prodmaateid" type="java.lang.Short">
            <column name="prodmaateid" />
        </property>
        <property name="presseid" type="java.lang.Short">
            <column name="presseid" />
        </property>
        <property name="trykkformatid" type="java.lang.Short">
            <column name="trykkformatid" />
        </property>
        <property name="estopplag" type="java.lang.Integer">
            <column name="estopplag" />
        </property>
        <property name="nettoformat" type="string">
            <column name="nettoformat" length="50" />
        </property>
        <property name="omsetning" type="java.lang.Long">
            <column name="omsetning" />
        </property>
        <property name="gennotes" type="string">
            <column name="gennotes" />
        </property>
        <property name="fristmatfortrykk" type="string">
            <column name="fristmatfortrykk" length="100" />
        </property>
        <property name="kontaktfortrykk" type="string">
            <column name="kontaktfortrykk" />
        </property>
        <property name="fornotes" type="string">
            <column name="fornotes" />
        </property>
        <property name="trykknotes" type="string">
            <column name="trykknotes" />
        </property>
        <property name="kontaktpakkeri" type="string">
            <column name="kontaktpakkeri" />
        </property>
        <property name="fristmatpakkeri" type="string">
            <column name="fristmatpakkeri" length="100" />
        </property>
        <property name="arkivantall" type="java.lang.Integer">
            <column name="arkivantall" />
        </property>
        <property name="arkivlenge" type="java.lang.Integer">
            <column name="arkivlenge" />
        </property>
        <property name="istikk" type="boolean">
            <column name="istikk" />
        </property>
        <property name="inkjetid" type="java.lang.Short">
            <column name="inkjetid" />
        </property>
        <property name="etikettid" type="java.lang.Short">
            <column name="etikettid" />
        </property>
        <property name="week" type="java.lang.Short">
            <column name="week" />
        </property>
        <property name="year" type="java.lang.Short">
            <column name="year" />
        </property>
        <property name="bekreftetid" type="java.lang.Integer">
            <column name="bekreftetid" />
        </property>
        <many-to-one
            name="ansatt"
            class="Ansatt"
            lazy="false"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="ansattid"
            unique="true"
        />

        <property name="mainreportdate" type="timestamp">
            <column name="mainreportdate" length="8" />
        </property>
        <property name="mainreportversion" type="java.lang.Short">
            <column name="mainreportversion" />
        </property>
        <property name="confirmreportdate" type="timestamp">
            <column name="confirmreportdate" length="8" />
        </property>
        <property name="confirmreportversion" type="java.lang.Short">
            <column name="confirmreportversion" />
        </property>
        <property name="confirmnotes" type="string">
            <column name="confirmnotes" />
        </property>

        <property name="updatedby" type="java.lang.Integer">
            <column name="updatedby" />
        </property>

        <many-to-one
              name="updatedAnsatt"
              class="Ansatt"
              cascade="none"
              outer-join="auto"
              lazy="false"
              update="false"
              insert="false"
              column="updatedby"
              not-found="ignore"
              unique="true"
          />

        <property name="intnotes" type="string">
            <column name="intnotes" />
        </property>
        <property name="utgave" type="string">
            <column name="utgave" length="30" />
        </property>
        <property name="pakkerinotes" type="string">
            <column name="pakkerinotes" />
        </property>
        <property name="istikkname" type="string">
            <column name="istikkname" length="100" />
        </property>
        <property name="obstext" type="string">
            <column name="obstext" />
        </property>
        <property name="sisteside" type="timestamp">
            <column name="sisteside" length="8" />
        </property>
        <property name="sisteplate" type="timestamp">
            <column name="sisteplate" length="8" />
        </property>
        <property name="trykkstart" type="timestamp">
            <column name="trykkstart" length="8" />
        </property>
        <property name="godeaviser" type="timestamp">
            <column name="godeaviser" length="8" />
        </property>
        <property name="produsert" type="timestamp">
            <column name="produsert" length="8" />
        </property>
        <property name="levertrampe" type="timestamp">
            <column name="levertrampe" length="8" />
        </property>
        <property name="reklamasjon" type="boolean">
            <column name="reklamasjon" />
        </property>
        <property name="weekAvisdato" type="java.lang.Short">
            <column name="week_avisdato" />
        </property>
        <property name="yearAvisdato" type="java.lang.Short">
            <column name="year_avisdato" />
        </property>

        <one-to-one name="fortrykk"
              class="Fortrykk"/>

        <one-to-one name="opplag"
              class="Opplag"/>

        <one-to-one name="pakkeri"
              class="Pakkeri"/>

        <one-to-one name="trykk"
              class="Trykk"/>
       
        <many-to-one
            name="product"
            class="Product"
            fetch="join"
            lazy="false"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="productid"
            unique="true"
        />

        <list
            name="leveringer" table="leveringer"
            lazy="false"
            cascade="all">

            <key column="ordreid"/>
            <list-index column="id" />
            <composite-element class="Leveringer">
              <property name="mottaker" type="string">
                  <column name="mottaker" length="100" />
              </property>
              <property name="levadresse" type="string">
                  <column name="levadresse" length="150" />
              </property>
              <property name="attn" type="string">
                  <column name="attn" length="100" />
              </property>
              <property name="telefon" type="string">
                  <column name="telefon" length="80" />
              </property>
              <property name="transportor" type="string">
                  <column name="transportor" length="100" />
              </property>
              <property name="beskjed" type="string">
                  <column name="beskjed" />
              </property>
              <property name="antaviser" type="string">
                  <column name="antaviser" length="50" />
              </property>
              <property name="avtfrist" type="timestamp">
                  <column name="avtfrist" length="8" />
              </property>
              <property name="etterbehandling" type="string">
                  <column name="etterbehandling" length="100" />
              </property>
              <property name="notes" type="string">
                  <column name="notes" />
              </property>
              <property name="levid" type="java.lang.Short">
                  <column name="levid" />
              </property>
              <property name="postbladid" type="java.lang.Short">
                  <column name="postbladid" />
              </property>
              <property name="postpostid" type="java.lang.Short">
                  <column name="postpostid" />
              </property>
              <property name="merknad" type="string">
                  <column name="merknad" />
              </property>
          </composite-element>

        </list>

        <list
            name="istikks" table="istikk"
            lazy="false"
            cascade="all">

            <key column="ordreid"/>
            <list-index column="id" />
            <composite-element class="Istikk">
              <property name="navn" type="string">
                  <column name="navn" length="100" />
              </property>
              <property name="kontakt" type="string">
                  <column name="kontakt" />
              </property>
              <property name="telefon" type="string">
                  <column name="telefon" length="100" />
              </property>
              <property name="avtalt" type="timestamp">
                  <column name="avtalt" length="8" />
              </property>
              <property name="faktisk" type="timestamp">
                  <column name="faktisk" length="8" />
              </property>
              <property name="antall" type="integer">
                  <column name="antall" />
              </property>
              <property name="soning" type="string">
                  <column name="soning" length="100" />
              </property>
              <property name="sidetall" type="integer">
                  <column name="sidetall" />
              </property>
              <property name="format" type="string">
                  <column name="format" length="70" />
              </property>
              <property name="vekt" type="short">
                  <column name="vekt" />
              </property>
              <property name="overvakning" type="boolean">
                  <column name="overvakning" />
              </property>
              <property name="disk" type="boolean">
                  <column name="disk" />
              </property>
              <property name="limes" type="boolean">
                  <column name="limes" />
              </property>
              <property name="manuell" type="boolean">
                  <column name="manuell" />
              </property>
              <property name="spoles" type="string">
                  <column name="spoles" length="70" />
              </property>
              <property name="arkiveres" type="boolean">
                  <column name="arkiveres" />
              </property>
              <property name="antallkunde" type="integer">
                  <column name="antallkunde" />
              </property>
              <property name="plastpakkes" type="boolean">
                  <column name="plastpakkes" />
              </property>
              <property name="notes" type="string">
                  <column name="notes" />
              </property>
              <property name="istikktypeid" type="java.lang.Short">
                  <column name="istikktypeid" />
              </property>
            </composite-element>
        </list>

        <list
            name="logDistributionFramgangDefaults" table="log_distframgangdefault"
            lazy="false"
            cascade="all">

            <key column="produktid" property-ref="productid"/>
            <list-index column="id"/>
            <composite-element class="LogDistFramgangDefault">
              <property name="distributionid" type="java.lang.Integer">
                  <column name="distributionid" />
              </property>
              <property name="departure" type="time">
                  <column name="departure" length="8" />
              </property>
              <property name="arrival" type="time">
                  <column name="arrival" length="8" />
              </property>
              <property name="description" type="string">
                  <column name="description" length="100" />
              </property>
            </composite-element>

        </list>

        <list
            name="logFortrykkFramgangDefaults" table="log_fortrykkframgangdefault"
            lazy="false"
            cascade="all">

            <key column="productid" property-ref="productid"/>
            <list-index column="id"/>
            <composite-element class="LogFortrykkFramgangDefault">
              <property name="description" type="string">
                  <column name="description" length="30" />
              </property>
              <property name="tid" type="time">
                  <column name="tid" length="8" />
              </property>
              <property name="avtalt" type="integer">
                  <column name="avtalt" />
              </property>
            </composite-element>

        </list>

    </class>
</hibernate-mapping>




BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 02, 2006 6:27 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Can the productid column be null? If you specify not-null="true" in the two relevant key mappings, then you should be sorted. If not, then you may find that "faking" it may help: change the definition of OrdreNew's productid column to be not-null in the database (and in the mapping, though that doesn't matter), and give it a default value of something like -1. Then add the not-null="true" bits to the two keys.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:40 am 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
No, productid always has a value, i.e. logDistributionFramgangDefaults and logFortrykkFramgangDefaults always gets created connected to the parent..
But the problem? is that OrdreNew is not really the parent; another class is, so I gave up and moved the association back to the parent class...

But as far as I can tell, using property-ref like this, should work........


BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:49 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Good. So specify not-null="true" in the two key mappings, I think that that will fix it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:56 am 
Beginner
Beginner

Joined: Tue Mar 21, 2006 5:49 pm
Posts: 20
ok, I will see if I have time to test it later today... Thx... :)

BTJ

_________________
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.