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.  [ 1 post ] 
Author Message
 Post subject: help! not-null property references a null or transient value
PostPosted: Thu Nov 11, 2004 2:21 pm 
Newbie

Joined: Fri Oct 08, 2004 9:26 am
Posts: 17
Stack trace of death:

hibernate exception occured
net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: net.gumb.datatypes.auction.seller
at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1277)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:928)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:952)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.gumb.service.dynPxImpl.doSomething(dynPxImpl.java:103)
at dynPxService.doSomething(dynPxService.java:25)
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:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

Mapping Doc:

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

<hibernate-mapping>

<class name="net.gumb.datatypes.seller" table="sellers">
<!-- automatically generated primary key for this class -->
<id name="id" type="integer">
<generator class="native"/>
</id>

<!-- the ebay username of this particular seller -->
<property name="username" column="username" type="string" />
</class>

<class name="net.gumb.datatypes.bidder" table="bidder">
<!-- automatically generated primary key for this class -->
<id name="id" type="integer">
<generator class="native"/>
</id>

<!-- the ebay username of this particular seller -->
<property name="username" column="username" type="string" />
</class>

<class name="net.gumb.datatypes.bid" table="bid">
<!-- automatically generated primary key for this class -->
<id name="id" type="integer">
<generator class="native"/>
</id>

<many-to-one name="bidder"
class="net.gumb.datatypes.bidder"
cascade="none"
column="bidder_id"
update="false"
not-null="true"
outer-join="false"
/>


<property name="bidvalue" column="bidvalue" type="currency" />
</class>




<!-- MARKET
class encapsulating a set of homogenous goods provided by sellers which buyers may place bids on
-->
<class name="net.gumb.datatypes.market" table="market">
<!-- automatically generated primary key for this class -->
<id name="id" type="integer">
<generator class="native"/>
</id>

<!-- search criteria for spider, words which return an appropriate list of auctions-->
<property name="name" column="name" type="string" />

<!-- unordered collection of auctions which represent individual products for sale in the market -->
<bag name="auction" table="auctions" cascade="all" inverse="true">
<key column="marketID"/>
<one-to-many class="net.gumb.datatypes.auction"/>
</bag>

</class>

<!-- AUCTION
class encapsulating a individual product offered for sale, and the interactions with different actors
which determine it's final price.
-->
<class name="net.gumb.datatypes.auction" table="auctions">
<!-- automatically generated primary key for this class -->
<id name="id" type="integer">
<generator class="native"/>
</id>


<property name="auctionNo" column="auctionno" type="string" />

<!-- wheather or not this auction has closed. -->
<property name="complete" column="complete" type="boolean"/>

<!-- associated class representing the seller of the product.-->
<many-to-one name="seller"
class="net.gumb.datatypes.seller"
cascade="none"
column="SELLER_ID"
update="false"
outer-join="false"
/>

<!-- list of bids which have been placed in this auction
with multiple bids by same bidder.-->

<bag name="bids"
cascade="all"
inverse="true"
lazy="true"
>
<key>
<column name="auction_id" not-null="true"/>
</key>
<one-to-many class="net.gumb.datatypes.bid"/>
</bag>


</class>




</hibernate-mapping>

and finally the code (like a test case almost):

try{
Session session = hibernateService.currentSession();
Transaction tx= session.beginTransaction();


seller sellr = new seller();
sellr.setUsername("Seller1");

bidder bidr1 = new bidder();
bidr1.setUsername("bidder1");
bidder bidr2 = new bidder();
bidr1.setUsername("bidder2");
bidder bidr3 = new bidder();
bidr1.setUsername("bidder3");

Currency cur = Currency.getInstance("EUR");

bid bid1 = new bid();
bid1.setBidder(bidr1);
bid1.setBidvalue(cur);
bid bid2 = new bid();
bid2.setBidder(bidr2);
bid2.setBidvalue(cur);
bid bid3 = new bid();
bid3.setBidder(bidr3);
bid3.setBidvalue(cur);
bid bid4 = new bid();
bid4.setBidder(bidr3);
bid4.setBidvalue(cur);

ArrayList bids1 = new ArrayList();
bids1.add(bid1);
bids1.add(bid2);
bids1.add(bid3);

ArrayList bids2 = new ArrayList();
bids2.add(bid4);

auction auc1 = new auction();
auc1.setAuctionNo("4312412412341");
auc1.setSeller(sellr);
auc1.setBids(bids1);

auction auc2 = new auction();
auc2.setAuctionNo("3423142142344");
auc2.setSeller(sellr);
auc1.setBids(bids2);

ArrayList aucs = new ArrayList();
aucs.add(auc1);
aucs.add(auc2);

market mkt = new market();
mkt.setName("sony camera");
mkt.setAuction(aucs);

session.save(mkt);

// session.save(mkt);
tx.commit();
HibernateUtil.closeSession();

logger.info("saved to db ok");


}
catch (HibernateException e){logger.info("hibernate exception occured"); e.printStackTrace();}
}

makes the exception of death at the top. what am i missing, been staring at this for hours. :<


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

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.