-->
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.  [ 5 posts ] 
Author Message
 Post subject: about one-to-many
PostPosted: Tue Jan 18, 2005 4:49 am 
Newbie

Joined: Tue Jan 18, 2005 4:29 am
Posts: 6
have two tables:father(pk:fid) and childs(pk:fid,cid).their relation is one-to many;
hbm.xml files are:
###Childs.hbm.xml:
<?xml version="1.0"?>

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

<hibernate-mapping>
<class
name="tutorial.hibernate.Childs"
table="childs"
dynamic-update="false"
dynamic-insert="false"
>

<composite-id
name="ckey"
class="tutorial.hibernate.ChildsKey"
>
<key-property
name="cid"
type="java.lang.String"
column="cid"
/>

<key-many-to-one
name="fid"
class="tutorial.hibernate.Father"
column="fid"
/>

</composite-id>

<property
name="cname"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="cname"
/>

<many-to-one
name="father"
class="tutorial.hibernate.Father"
cascade="none"
outer-join="auto"
update="false"
insert="false"
access="property"
column="fid"
not-null="true"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Childs.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>
###Father.hbm.xml
<?xml version="1.0"?>

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

<hibernate-mapping>
<class
name="tutorial.hibernate.Father"
table="father"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="fid"
column="fid"
type="string"
unsaved-value="null"
>
<generator class="assigned">
</generator>
</id>

<property
name="fname"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="fname"
/>

<set
name="childs"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="fid"
>
</key>

<one-to-many
class="tutorial.hibernate.Childs"
/>
</set>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Father.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>
java files:
##Father.java:
package tutorial.hibernate;

import java.util.Set;

/**
* @hibernate.class table = "father"
*/

public class Father
{
private String fid;

private String fname;

private Set childs;


public Father()
{
super();
}

/**
* @hibernate.id generator-class = "assigned" unsaved-value = "null"
* type = "string"
* column = "fid"
*/
public String getFid()
{
return fid;
}
public void setFid(String fid)
{
this.fid = fid;
}
/**
* @hibernate.property
* @return String
*/
public String getFname()
{
return fname;
}

public void setFname(String fname)
{
this.fname = fname;
}
/**
* @hibernate.set inverse = "false" lazy = "false" cascade = "none"
* @hibernate.collection-key column = "fid"
* @hibernate.collection-one-to-many class = "tutorial.hibernate.Childs"
*/
public Set getChilds()
{
return childs;
}
public void setChilds(Set childs)
{
this.childs = childs;
}
}
##Childs.java:
package tutorial.hibernate;

/**
* @hibernate.class table = "childs"
*/

public class Childs
{
private ChildsKey ckey;

private String cname;

private Father father;

/**
* @hibernate.id generator-class = "assigned"
* @hibernate.collection-composite-element class = "tutorial.hibernate.ChildsKey"
* @hibernate.collection-key column = "fid"
* @hibernate.collection-key column = "cid"
*/
public ChildsKey getCkey()
{
return ckey;
}

public void setCkey(ChildsKey ckey)
{
this.ckey = ckey;
}

/**
* @hibernate.property
* @return String
*/
public String getCname()
{
return cname;
}

public void setCname(String cname)
{
this.cname = cname;
}

/**
* @hibernate.many-to-one column = "fid" class = "tutorial.hibernate.Father"
* insert = "false" update = "false" not-null = "true"
*/
public Father getFather()
{
return father;
}
public void setFather(Father father)
{
this.father = father;
}
}
##ChildsKey.java
package tutorial.hibernate;

import java.io.Serializable;

public class ChildsKey implements Serializable
{
private String fid;

private String cid;

/**
* @hibernate.property column = "cid"
*/
public String getCid()
{
return cid;
}

public void setCid(String cid)
{
this.cid = cid;
}

/**
* @hibernate.many-to-one column = "fid" class = "tutorial.hibernate.Father" not-null = "true"
*/
public String getFid()
{
return fid;
}

public void setFid(String fid)
{
this.fid = fid;
}

/**
* 以下两个方法一定要有啊
*/
public boolean equals(Object o)
{
if (o == null) { return false; }
if (getClass().equals(o.getClass())
&& fid.equals(((ChildsKey) o).getFid())
&& cid.equals(((ChildsKey) o).getCid()))
{
return true;
}
else
{
return false;
}

}

public int hashCode()
{
int result;
result = fid.hashCode();
result = 29 * result + cid.hashCode();
return result;
}

}

occuring error when run the follow code:
...
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();

Father f = (Father) session.load(Father.class, "f1");
System.out.println(f.getFname());
Set set = f.getChilds();
Iterator it = set.iterator();
while(it.hasNext())
{
Childs c = (Childs)it.next();
System.out.println(" "+c.getCname());
}
session.flush();
tx.commit();
HibernateUtil.closeSession();
...
the error is :
15:12:50,781 INFO [STDOUT] Hibernate: select father0_.fid as fid0_, father0_.fn
ame as fname0_ from father father0_ where father0_.fid=?
15:12:50,781 INFO [STDOUT] Hibernate: select childs0_.cid as cid__, childs0_.fi
d as fid__, childs0_.cid as cid0_, childs0_.fid as fid0_, childs0_.cname as cnam
e0_, childs0_.fid as fid0_ from childs childs0_ where childs0_.fid=?
15:12:50,796 INFO [STDOUT] net.sf.hibernate.PropertyAccessException: exception
setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=
false for more info) setter of tutorial.hibernate.ChildsKey.setFid
at net.sf.hibernate.type.ComponentType.setPropertyValues(ComponentType.j
ava:219)
at net.sf.hibernate.type.ComponentType.resolveIdentifier(ComponentType.j
ava:390)
at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:14
5)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.ja
va:80)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(Ab
stractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.ja
va:3226)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(
PersistentCollection.java:340)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(Sessio
nImpl.java:3089)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:831)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:851)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:
419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2081)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1955
)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1884)
at tutorial.ejb.FiboBean.test(FiboBean.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:113)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(Service
EndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
Interceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:316)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
49)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:128)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:6
24)
at org.jboss.ejb.Container.invoke(Container.java:854)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(Loca
lInvoker.java:155)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)

at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(Marshalling
InvokerInterceptor.java:55)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:5
5)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
onInterceptor.java:97)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
at $Proxy87.test(Unknown Source)
at tutorial.web.TestServlet.doPost(TestServlet.java:54)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
ipalValve.java:44)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:169)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
0)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.cglib.beans.BulkBeanException
at tutorial.hibernate.ChildsKey$$BulkBeanByCGLIB$$9cbb74c9.setPropertyVa
lues(<generated>)
at net.sf.hibernate.type.ComponentType.setPropertyValues(ComponentType.j
ava:215)
... 91 more
Caused by: java.lang.ClassCastException
... 93 more
15:12:50,828 INFO [CachedConnectionManager] Closing a connection for you. Plea
se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@fcf06c

java.lang.Exception: STACKTRACE
at org.jboss.resource.connectionmanager.CachedConnectionManager.register
Connection(CachedConnectionManager.java:319)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateC
onnection(BaseConnectionManager2.java:477)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$Connectio
nManagerProxy.allocateConnection(BaseConnectionManager2.java:838)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp
erDataSource.java:102)
at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnectio
n(DatasourceConnectionProvider.java:59)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278
)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.j
ava:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)

at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:831)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:851)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:
419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2081)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1955
)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1884)
at tutorial.ejb.FiboBean.test(FiboBean.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:113)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(Service
EndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
Interceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:316)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
49)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:128)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:6
24)
at org.jboss.ejb.Container.invoke(Container.java:854)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(Loca
lInvoker.java:155)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)

at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(Marshalling
InvokerInterceptor.java:55)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:5
5)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
onInterceptor.java:97)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
at $Proxy87.test(Unknown Source)
at tutorial.web.TestServlet.doPost(TestServlet.java:54)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
ipalValve.java:44)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:169)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
0)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:683)
at java.lang.Thread.run(Thread.java:534)

can anyone help i?
ths


Top
 Profile  
 
 Post subject: Can anyone help me ?
PostPosted: Wed Jan 19, 2005 10:05 pm 
Newbie

Joined: Tue Jan 18, 2005 4:29 am
Posts: 6
Can anyone help me ?


Top
 Profile  
 
 Post subject: could post your java codes on inserting the new data to db?
PostPosted: Thu Jan 20, 2005 3:12 am 
Newbie

Joined: Mon Jan 17, 2005 9:05 am
Posts: 17
Hi, sincedar,

I am the one you ever help me on giving me the example codes of mapping the 2 tables of father and child.

I am so frustrated because i am still stuck here. Could you help one more time? i am trying same example as you described in your post here.

I saw that you are succeeding in insert new data in to your table, right?

Could you post out part of your"after session open and before session close " here. To show me how to initialize primary key class, and how to assign id to primray key class and save to database?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 10:31 pm 
Newbie

Joined: Tue Jan 18, 2005 4:29 am
Posts: 6
HI,all
When i cancel the many-to-one relation,the code is right,but why i don't know ,can anyone help me ?


Top
 Profile  
 
 Post subject: P.S.
PostPosted: Fri Jan 21, 2005 4:04 am 
Newbie

Joined: Tue Jan 18, 2005 4:29 am
Posts: 6
P.S.
when i change the ChildsKey class's "/**
* @hibernate.many-to-one column = "fid" class = "tutorial.hibernate.Father"
*/" to /**
* @hibernate.property
*/,that is ok ,why?


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