[Hibernate] wrong behavior in the net.sf.hibernate.collection.Set.remove()

2003-08-01 Thread jiesheng zhang
I had an object a of type A retieved from hibernate Set. I did some modification to the a. During this process, its hashCode changed. Then I would like to remove it from the Set. I removed it like this net.sf.hibernate.collection.Set.remove(A). The hibernate Set can not find and remove the Object

[Hibernate] What does this exception mean?

2003-08-04 Thread jiesheng zhang
Hi, all Caused by: net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade Any hint what might cause this exception? Thanks jason __ Do you Yahoo!? Yahoo! SiteBuilder - Free

Re: [Hibernate] Saving collections...

2003-01-30 Thread jiesheng zhang
--- [EMAIL PROTECTED] wrote: > > You need to learn about the mysteries of the > unsaved-value > attribute :) > > Hibernate looks at the id value to determine if an > object > discovered by cascade is "new" or not. So, if you > have an > object with a Long identifier, set > unsaved-value="null".

Re: [Hibernate] what does "readonly=true" mean in a bidirectional association?

2003-01-30 Thread jiesheng zhang
--- [EMAIL PROTECTED] wrote: > > >Here the children set in the Parent object is > >readonly. Does it mean any modification to any > "Child > >element" in the Children set will not be persisted > to > >database( an violation of usual persistence by > >reachability)? In > > No, it is nothing to do

[Hibernate] what does "readonly=true" mean in a bidirectional association?

2003-01-29 Thread jiesheng zhang
Use the example from hibernate-reference manual: Here the children set in the Parent object is readonly. Does it mean any modification to any "Child element" in the Children set will not be persisted to database( an violation of usual persistence by reachability

Re: [Hibernate] hib2 - parent in composite-element

2003-02-02 Thread jiesheng zhang
I use the Java code instead of Hibernate to keep the parent-child relationship. For example suppose I have such a relationship Parent-->Level1-->Level2 The class implementation could be like this public class parent { public void setChild(Level1 child){ if (child.getParent()==null) child.set

[Hibernate] set, bag and list

2003-01-30 Thread jiesheng zhang
I have a collection of thing. I do not care whether there is duplication or not. I can use Set to prohibit duplication. I can also use list and bag. If I use Set rather than list/bag, I think the performance is not so good as it is for list/bag, since set has to limit duplication. I noticed that

[Hibernate] hibernate set foreign key to null before issue deletion?

2003-01-30 Thread jiesheng zhang
suppose I have two table create table A ( id integer primary key ); create table B ( id integer primary key, idA integer not null, constraint FK_B_TO_A foreign key (idA) references A (id) on delete cascade ); Here suppose A to B is a one-to-many asso

Re: [Hibernate] should be added to ...?

2003-02-03 Thread jiesheng zhang
crete example I encoutered in my application. Thanks jason > > > > > > jiesheng zhang > >

[Hibernate] any successful story with hibernate?

2003-01-23 Thread jiesheng zhang
Hi, guys I am currently designing a Java project. I'd like to use a Object relational mapping tool to manage the persistnece layer. My friend suggests hibernate for me. Other people also warns me about the capability of Object relation mapping solution. This makes me worry about the hibernate capa

Re: [Hibernate] hibernate set foreign key to null before issue deletion?

2003-01-30 Thread jiesheng zhang
Clarify my question here: suppose I have two table create table A ( id integer primary key ); create table B ( id integer primary key, idA integer not null, constraint FK_B_TO_A foreign key (idA) references A (id) on delete cascade ); Here suppose

[Hibernate] interface and implemenation mapping

2003-01-30 Thread jiesheng zhang
Suppose we have a interface A, and an implemenation class A_Impl. In this case, there is no discriminator column and discrimator value. Can I use ... to map this? Or I have to use http://mailplus.yahoo.com --- This SF.NET email is sp

Re: [Hibernate] How to do this (assiciation)?

2003-02-13 Thread jiesheng zhang
Can I implement this as this? Leave Address as a interface. Class ToAddress--- mapped to address with type='t' class CCAddress---mapped to Address with type='c' Then in Class has two sets toaddr mapped to a list of ToAddress ccaddrmapped to a list of CCAddress Althought I did not try, but

[Hibernate] should be added to ...?

2003-02-03 Thread jiesheng zhang
I have one usage scenario as below: The classes could be like this. public class Person { ... List Addresses; //A list of Address objects. } public class Address { ... List types; //A list of AddressType object } public class AddressType { long typenum;

Re: [Hibernate] Parent / Child Mapping with composite-id

2003-02-05 Thread jiesheng zhang
> > table="child"> > class="org.appfuse.persistence.ChildId" > unsaved-value="none"> > length="22" name="parentId" > type="long"/> Try this: and remove the the below. > length="22" name="recordNum" > type="long"/> > > nam

Re: [Hibernate] hib2 - parent in composite-element

2003-02-03 Thread jiesheng zhang
--- Viktor Szathmary <[EMAIL PROTECTED]> wrote: > hi, > > On Mon, 3 Feb 2003 09:32:39 +1100, > [EMAIL PROTECTED] said: > > > > Are there proxies involved? > > > > hopefully not :) it seems that there's actually two > calls to > nestedChild.setParent() on the same nestedChild > instance - the s

[Hibernate] experince in equals() and hashCode()

2003-09-09 Thread jiesheng zhang
import java.util.Random; public class A { // the object id, unsaved=0; private long id=0; private String value; public boolean equals(Object obj) { if (obj==this) { /*

[Hibernate] proxy, abstract class, ClassCastException.

2003-09-10 Thread jiesheng zhang
My problem is that I know one object is type A, but when I try to cast to A, I got a ClassCastException. I have four classes in my cases: ContentDB, ServerFileSysNode, InnerNode, and SharedFileSysNode. ServerFileSysNode(abstract) InnerNode (concrete subclass of ServerFileSysNode, may have

Re: [Hibernate] self-referential table

2003-09-10 Thread jiesheng zhang
It definitely works. I have many such methods like what you mentioned. Post your method implementation and exception here. Let me have a look. jason --- Warner Onstine <[EMAIL PROTECTED]> wrote: > Got this working! > > Now I have another question with regards to > collections in general. > >

[Hibernate] bad performance during flush and help is needed.

2003-09-11 Thread jiesheng zhang
My system is a prototype system. There is only one test user at any time. For this user, there is about 500-600 objects loaded in the Hibernate session at maximal. Very often, my application needs to change only one field in one object and commit the transaction. My code is like this Tranactio

Re: [Hibernate] bad performance during flush and help is needed.

2003-09-12 Thread jiesheng zhang
in the session. Obtaining database connection should not be a problem since the database connection is pooled at Tomcat layer. How do you think of this idea? Thanks jason > jiesheng zhang wrote: > > >First I have a source class like this. > >public class Source > &

Re: [Hibernate] bad performance during flush and help is needed.

2003-09-12 Thread jiesheng zhang
First I have a source class like this. public class Source { Transaction tx; List pendingRemovedItems; public void beginTransaction() { // here I use ThreadLocal pattern. tx= ThreadState.getSession().beginTransaction(); }

[Hibernate] some performnace metric for the dirty check during hibernate flush.

2003-09-16 Thread jiesheng zhang
Hi, I once suspect that hibernate take too much time in doing dirty check during session flush. However Gavin king and other hibernate-user disagreed with me. I did a simple performance testing to verify the dirty check performance. My conslusion is that the performance is not so good if there a