Re: [Hibernate] Cursors still open after session.close()

2003-01-21 Thread Matt Raible
> If there's someone else using Hibernate under Tomcat (Matt?) or other > containers, I'd like to ask whether you're using the container's pooling > implementation or Hibernate's and why. I'm using Tomcat's (v4.1.18) DBCP and it seems to work just fine. I've been told that I'm doing my sessions

Re: [Hibernate] Cursors still open after session.close()

2003-01-21 Thread Ugo Cei
Jozsa Kristof wrote: I'd try removing the commit from the finally case.. if that line drops an exception (and it CAN drop, as you dont handle the session.close()'s exception either!), you'll method will return with the exception and the session would NOT get closed. You wouldn't want to commit anyw

Re: [Hibernate] Cursors still open after session.close()

2003-01-21 Thread Jozsa Kristof
On Tue, Jan 21, 2003 at 12:01:34PM +0100, Ugo Cei wrote: > I'm using Hibernate 1.2.1 in a webapp under JDK 1.4.1, Tomcat 4.1.12, > Oracle 8i and I'm experiencing this phenomenon: cursor are still open > after I close the session. This is a sample servlet code: > > try { >session = sessionFac

[Hibernate] Re: Comment: Hibernate Help Needed

2003-01-21 Thread Matt Raible
Gavin, In response to your comment on my weblog - seem comments below... > unsaved-value="null" makes no sense for composite-ids or any other kind of > "assigned" id. Thats because the identifier property is *never* null when > Hibernate gets to it. > > Now, I'm assuming that what you *reall

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Gavin King
I have tracked down Matt's problem to a little bug in the mapping parsing code in 1.2.x that ignores the unsaved-value attribute of . Woops! I will fix this ASAP. Sorry to any who wasted time on this. Gavin --- This SF.net email is sponsor

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Gavin King
In the code you sent me, unlike in the mapping below, you have mapped the Child class with unsaved-value="any". This means that the cascade saveOrUpdate() will *always* do an insert for each child. If you want to force it to always do an update, use unsaved-value="none", as below. Please verify tha

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Matt Raible
I sent the e-mail below to Gavin last night, but I might as well send it to the group to see if anyone else might be able to offer a tip or two. --- I whipped up a quick example and was able to reproduce my problem on MySQL (I was using Oracle today). It was easy to do in my appfuse project, so I

[Hibernate] Cursors still open after session.close()

2003-01-21 Thread Ugo Cei
I'm using Hibernate 1.2.1 in a webapp under JDK 1.4.1, Tomcat 4.1.12, Oracle 8i and I'm experiencing this phenomenon: cursor are still open after I close the session. This is a sample servlet code: try { session = sessionFactory.openSession(); List istituti = session.find ("from Istituto

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Gavin . King
saveOrUpdate() requires that (1) the object has an identifier property (2) the identifier class implements equals() and hashCode() (3) unsaved-value is set correctly I recommend that you try enabling logging to see what Hibernate is doing. If you still can't find a solution, email me a simple m

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Raible, Matt
Is it possible that saveOrUpdate will not work for the children of this object, and I have to use update(obj, id) instead? Damn, I thought hibernate was easy and now it's kicking my ass! It's probably something super simple and I'm just not seeing it. To re-iterate (I know you guys hate me by no

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Raible, Matt
I tried changing: to: and it still doesn't work. I added debugging to my equals method, and there is 6 children and they all appear to be equal, but it still tried to do an insert: [junit] equals: tru

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Gavin . King
I *think* that you would just have to set unsaved-value="none" for the composite-id children in order to convince Hibernate to do an update rather than an insert. (You also need to make sure that you are assigning unique composite id values to all the children before flushing.) "null" will not w

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Raible, Matt
So I've found the offending SQL statement: [junit] Hibernate: insert into CMCF_MPS ( ENCRYPT_TSODA, DECRYPT_TSODA, SATELLITE, TRANSPONDER, EIA_CHANNEL, NETWORK_NAME, STATUS_ID, MSG_ID, CCR_ID, RECORD_NUM ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) How does hibernate determine if it should do

RE: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Raible, Matt
OK, I now have a pk property (+ getter/setter) in my child object, and I removed the properties for ccrId and recordNum. My composite-id element now has a name="pk" attribute. The select still seems to work fine and I'm getting the expected number of children. However, when I try to save, I get

Re: [Hibernate] Saving Children with composite-id

2003-01-21 Thread Gavin . King
Looks like you need to add a name attribute to the element, to specify which property holds the composite id. "Raible, Matt"

RE: [Hibernate] How about a new mailinglist for announce?

2003-01-21 Thread Gavin . King
I think its harder for XDoclet to stick to the kind of rapid release schedule we have, simply because XDoclet must be MUCH harder to test. You have a *lot* more platforms and platform-specific stuff going on there. Normally i can run tests against about 4 databases before a release and be confid

RE: [Hibernate] How about a new mailinglist for announce?

2003-01-21 Thread Aslak Hellesoy
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Sven > Welte > Sent: 20. januar 2003 23:36 > To: [EMAIL PROTECTED] > Subject: RE: [Hibernate] How about a new mailinglist for announce? > > > On Tue, 21 Jan 2003, Ara Abrahamian wrote: > > > From my exper