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. I noticed that

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 with cascades.

[Hibernate] Saving collections...

2003-01-30 Thread Matt Dowell
Easy question, I think. I am trying something like this: Product p = new Product(); p.setName(blah); ProductLineItem item = new ProductLineItem(); item.setName(blah line item); // Add a line item to the product p.addLineItem(item); Session.save(p); .and it is inserting the Product, and

Re: [Hibernate] parent for composite-element

2003-01-30 Thread Viktor Szathmary
On Thu, 30 Jan 2003 17:17:54 +1100, [EMAIL PROTECTED] said: So do you want to just do a little experiment to find out which version(s) support parent for composite-element, because I forget. the 1.1 DTD doesn't allow this, and even if i force it in there, it's apprently ignored... i'm using

[Hibernate] RE: [Hibernate] Communication link failure: java.io.IOException

2003-01-30 Thread Raible, Matt
You can remedy this problem with MySQL by adding autoReconnect=true in your JDBC URL. For instance: jdbc:mysql://localhost/mydatabase?autoReconnect=true I've also heard that adding a validationQuery parameter will have a similar effect (at least with Oracle): parameter

[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

RE: RE: [Hibernate] CodeGenerator in Hibernate2

2003-01-30 Thread Aapo Laakkonen
I agree 100%, and I'm puzzled by this. I posted about that in the Forum on SF, asking the same questions. Ok... it's strange... Hibernate uses several metatags to do this. Defaults SUCK big time if you ask me. And it also uses the same function for both (getFieldScope). I attached fixed

RE: [Hibernate] CodeGenerator in Hibernate2

2003-01-30 Thread Aapo Laakkonen
Ok, I see that the BasicRenderer seems to want some parameter and it defaults to private, which is insane, I think (should default to public). --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something

RE: [Hibernate] Obtaining session in a filter

2003-01-30 Thread Raible, Matt
I added some debug parameters, and you're right that the lookup happens each time. It sounds to me like the HibernateSession class could be enhanced to allow only one lookup. Here is a first stab at it: public class HibernateSession { //~ Static fields/initializers

[Hibernate] CodeGenerator in Hibernate2

2003-01-30 Thread Aapo Laakkonen
Why does CodeGenerator in Hibernate2 generate private getters and setters? --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com

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

2003-01-30 Thread Gavin . King
1. add the child element to the children set. 2. save the child explicitly by calling Session.save(child). Is it right? If you have enabled cascades, you can skip (2). By specifying readonly, in the code I have to remember which set is readonly and I have to handle it differently from

[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

RE: [Hibernate] Obtaining session in a filter

2003-01-30 Thread Raible, Matt
I'm wondering if there's any problem with the following modifications to Jeff's Filter. The code below uses the HibernateSession object to obtain a session in a Filter. Seems to work pretty well for me. If there are any glaring problems, please let me know. If there aren't any issues with

[Hibernate] Efficient update() + collections

2003-01-30 Thread Gavin King
Just expecially for Max I have done some back-breaking coding (not really, it was easy as pie) tonight and implemented the behavior he requested, with respect to collections passed to update(). Collections now carry a snapshot around with them so that we can update individual rows. I had

Re: [Hibernate] Saving collections...

2003-01-30 Thread Gavin . King
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. Note that another approach is to save() the Item

RE: [Hibernate] Obtaining session in a filter

2003-01-30 Thread Aapo Laakkonen
I'm wondering if there's any problem with the following modifications to Jeff's Filter. Yes there is. More new InitialContext() lookups. This was one thing that Jeff tried to avoid. But yes your approach should work fine, but it causes a little more overhead (Or have you done some modification

[Hibernate] Communication link failure: java.io.IOException

2003-01-30 Thread Enrico Donelli
Hi everybody, I'm a newbye in using hibernate, so I beg you pardon in the question is dummy :). I'm using tomcat4 with mysql, and, of course, hibernate. I open and close the hibernate session with a filter, using a modified version of the filter published on the mailing list a couple of weeks

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

2003-01-30 Thread Gavin . King
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 with cascades. this sense, the readonly applies to the