I think there are still some things wrong with our Hibernate framework.
If I write a test-suite that only creates a new Crispo (and executes no finders), that object will never get persisted. Only if I do a find (and therefore a flush) will it get written out to the DB. Possible that the session isn't flushing when coming out of the test suite?
Another thing is that I've tried a million different things and am still unable to do create an easy cascading relationship between Crispo and CrispoOption. all-delete-orphan does not appear to work for me, no matter what I do. I've basically even followed their example and still couldn't get it to work: http://www.hibernate.org/hib_docs/reference/en/html/example- parentchild.html
If I delete the parent, Hibernate attempts to set the parent ID of the children to null (invalid), then delete the parent. Instead, it should perform 2 delete statements.
For the meantime, I'll go ahead and delete all the children manually, but this means that we cannot have a cascade from other objects to Crispos, since we'll have to invoke the delete method manually.. 😞
I'd recommend that if you are going to use inverse="true" collections then use inverse bags. one-to-many inverse=true bag collection use in hq have couple of benefits
1. consistency with rest of the object model 2. the xslt script will inject proper casade options when it processes the hq-xml into hbm.xml file.
If you must use sets, then try the same set of cascade options that we use for bags which is cascade="save-update,delete,evict,persist,merge" on the set element and on-delete="cascade" on the key element in the set.
- Young
Jon Travis wrote: > I think there are still some things wrong with our Hibernate framework. > > If I write a test-suite that only creates a new Crispo (and executes > no finders), that object will never get persisted. Only if I do a > find (and therefore a flush) will it get written out to the DB. > Possible that the session isn't flushing when coming out of the test > suite? > > Another thing is that I've tried a million different things and am > still unable to do create an easy cascading relationship between > Crispo and CrispoOption. all-delete-orphan does not appear to work > for me, no matter what I do. I've basically even followed their > example and still couldn't get it to work: > > http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html > > > If I delete the parent, Hibernate attempts to set the parent ID of the > children to null (invalid), then delete the parent. Instead, it > should perform 2 delete statements. > > For the meantime, I'll go ahead and delete all the children manually, > but this means that we cannot have a cascade from other objects to > Crispos, since we'll have to invoke the delete method manually.. 😞 > > -- Jon > > > >
The bug is a result of the fact that we process our .hq-xml files into .hbm files. It deletes my inverse="true" flag.
I would prefer that we DON'T use XSL to process all those files. If you look at the .hbm files, there are a million options that are already used as the default in Hibernate.
Look at one of our generated .hbm files. Compare that with anything in the HIbernate documentation.
- We don't even know what most of those options do - XSL is currently breaking my code - It's not necessary -- it just adds complexity to our framework & an extra processing step!
-- Jon
On Nov 10, 2006, at 11:47 AM, Young Lee wrote:
> Jon, > > I'd recommend that if you are going to use inverse="true" > collections then use inverse bags. one-to-many > inverse=true bag collection use in hq have couple of benefits > > 1. consistency with rest of the object model > 2. the xslt script will inject proper casade options when it > processes the hq-xml into hbm.xml file. > > If you must use sets, then try the same set of cascade options that > we use for bags which is > cascade="save-update,delete,evict,persist,merge" on the set element > and > on-delete="cascade" on the key element in the set. > > - Young > > Jon Travis wrote: >> I think there are still some things wrong with our Hibernate >> framework. >> >> If I write a test-suite that only creates a new Crispo (and >> executes no finders), that object will never get persisted. Only >> if I do a find (and therefore a flush) will it get written out to >> the DB. Possible that the session isn't flushing when coming out >> of the test suite? >> >> Another thing is that I've tried a million different things and am >> still unable to do create an easy cascading relationship between >> Crispo and CrispoOption. all-delete-orphan does not appear to >> work for me, no matter what I do. I've basically even followed >> their example and still couldn't get it to work: >> http://www.hibernate.org/hib_docs/reference/en/html/example- >> parentchild.html >> >> If I delete the parent, Hibernate attempts to set the parent ID of >> the children to null (invalid), then delete the parent. Instead, >> it should perform 2 delete statements. >> >> For the meantime, I'll go ahead and delete all the children >> manually, but this means that we cannot have a cascade from other >> objects to Crispos, since we'll have to invoke the delete method >> manually.. 😞 >> >> -- Jon >> >> >> >>
Well, if u do not want xsl processing for the hbm files, then do not name it with hq-xml suffix.
- Young
Jon Travis wrote: > I've gotten this to work. > > The bug is a result of the fact that we process our .hq-xml files into > .hbm files. It deletes my inverse="true" flag. > > I would prefer that we DON'T use XSL to process all those files. If > you look at the .hbm files, there are a million options that are > already used as the default in Hibernate. > > Look at one of our generated .hbm files. Compare that with anything > in the HIbernate documentation. > > - We don't even know what most of those options do > - XSL is currently breaking my code > - It's not necessary -- it just adds complexity to our framework & an > extra processing step! > > -- Jon > > > > On Nov 10, 2006, at 11:47 AM, Young Lee wrote: > >> Jon, >> >> I'd recommend that if you are going to use inverse="true" collections >> then use inverse bags. one-to-many >> inverse=true bag collection use in hq have couple of benefits >> >> 1. consistency with rest of the object model >> 2. the xslt script will inject proper casade options when it >> processes the hq-xml into hbm.xml file. >> >> If you must use sets, then try the same set of cascade options that >> we use for bags which is >> cascade="save-update,delete,evict,persist,merge" on the set element and >> on-delete="cascade" on the key element in the set. >> >> - Young >> >> Jon Travis wrote: >>> I think there are still some things wrong with our Hibernate framework. >>> >>> If I write a test-suite that only creates a new Crispo (and executes >>> no finders), that object will never get persisted. Only if I do a >>> find (and therefore a flush) will it get written out to the DB. >>> Possible that the session isn't flushing when coming out of the test >>> suite? >>> >>> Another thing is that I've tried a million different things and am >>> still unable to do create an easy cascading relationship between >>> Crispo and CrispoOption. all-delete-orphan does not appear to work >>> for me, no matter what I do. I've basically even followed their >>> example and still couldn't get it to work: >>> >>> http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html >>> >>> >>> If I delete the parent, Hibernate attempts to set the parent ID of >>> the children to null (invalid), then delete the parent. Instead, it >>> should perform 2 delete statements. >>> >>> For the meantime, I'll go ahead and delete all the children >>> manually, but this means that we cannot have a cascade from other >>> objects to Crispos, since we'll have to invoke the delete method >>> manually.. 😞 >>> >>> -- Jon >>> >>> >>> >>> >
Regardless, our XSL translation should not break a perfectly valid Hibernate file. Since you're the only one here who reads XSL, I'll leave it to you to fix that bug.
I'll move my stuff to .hbm files
-- Jon
On Nov 10, 2006, at 12:50 PM, Young Lee wrote:
> Well, if u do not want xsl processing for the hbm files, then do > not name it with hq-xml suffix. > > - Young > > Jon Travis wrote: >> I've gotten this to work. >> >> The bug is a result of the fact that we process our .hq-xml files >> into .hbm files. It deletes my inverse="true" flag. >> >> I would prefer that we DON'T use XSL to process all those files. >> If you look at the .hbm files, there are a million options that >> are already used as the default in Hibernate. >> >> Look at one of our generated .hbm files. Compare that with >> anything in the HIbernate documentation. >> >> - We don't even know what most of those options do >> - XSL is currently breaking my code >> - It's not necessary -- it just adds complexity to our framework & >> an extra processing step! >> >> -- Jon >> >> >> >> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >> >>> Jon, >>> >>> I'd recommend that if you are going to use inverse="true" >>> collections then use inverse bags. one-to-many >>> inverse=true bag collection use in hq have couple of benefits >>> >>> 1. consistency with rest of the object model >>> 2. the xslt script will inject proper casade options when it >>> processes the hq-xml into hbm.xml file. >>> >>> If you must use sets, then try the same set of cascade options >>> that we use for bags which is >>> cascade="save-update,delete,evict,persist,merge" on the set >>> element and >>> on-delete="cascade" on the key element in the set. >>> >>> - Young >>> >>> Jon Travis wrote: >>>> I think there are still some things wrong with our Hibernate >>>> framework. >>>> >>>> If I write a test-suite that only creates a new Crispo (and >>>> executes no finders), that object will never get persisted. >>>> Only if I do a find (and therefore a flush) will it get written >>>> out to the DB. Possible that the session isn't flushing when >>>> coming out of the test suite? >>>> >>>> Another thing is that I've tried a million different things and >>>> am still unable to do create an easy cascading relationship >>>> between Crispo and CrispoOption. all-delete-orphan does not >>>> appear to work for me, no matter what I do. I've basically even >>>> followed their example and still couldn't get it to work: >>>> http://www.hibernate.org/hib_docs/reference/en/html/example- >>>> parentchild.html >>>> >>>> If I delete the parent, Hibernate attempts to set the parent ID >>>> of the children to null (invalid), then delete the parent. >>>> Instead, it should perform 2 delete statements. >>>> >>>> For the meantime, I'll go ahead and delete all the children >>>> manually, but this means that we cannot have a cascade from >>>> other objects to Crispos, since we'll have to invoke the delete >>>> method manually.. 😞 >>>> >>>> -- Jon >>>> >>>> >>>> >>>> >>
I have no idea why we are putting cascade="save- update,delete,evict,persist,merge" all over the place.
This just confuses people.
'all' encompasses everything except for delete-orphan.
For the most part we should be using 'all', 'all-delete-orphan', and 'save-update'
Moreover, your suggestion seems way more complex than just using the recommended pattern from the Hibernate team. It should be rudimentary.
-- Jon
On Nov 10, 2006, at 11:47 AM, Young Lee wrote:
> Jon, > > I'd recommend that if you are going to use inverse="true" > collections then use inverse bags. one-to-many > inverse=true bag collection use in hq have couple of benefits > > 1. consistency with rest of the object model > 2. the xslt script will inject proper casade options when it > processes the hq-xml into hbm.xml file. > > If you must use sets, then try the same set of cascade options that > we use for bags which is > cascade="save-update,delete,evict,persist,merge" on the set element > and > on-delete="cascade" on the key element in the set. > > - Young > > Jon Travis wrote: >> I think there are still some things wrong with our Hibernate >> framework. >> >> If I write a test-suite that only creates a new Crispo (and >> executes no finders), that object will never get persisted. Only >> if I do a find (and therefore a flush) will it get written out to >> the DB. Possible that the session isn't flushing when coming out >> of the test suite? >> >> Another thing is that I've tried a million different things and am >> still unable to do create an easy cascading relationship between >> Crispo and CrispoOption. all-delete-orphan does not appear to >> work for me, no matter what I do. I've basically even followed >> their example and still couldn't get it to work: >> http://www.hibernate.org/hib_docs/reference/en/html/example- >> parentchild.html >> >> If I delete the parent, Hibernate attempts to set the parent ID of >> the children to null (invalid), then delete the parent. Instead, >> it should perform 2 delete statements. >> >> For the meantime, I'll go ahead and delete all the children >> manually, but this means that we cannot have a cascade from other >> objects to Crispos, since we'll have to invoke the delete method >> manually.. 😞 >> >> -- Jon >> >> >> >>
do u have to use a set for inverse=true? can u use bag instead? bag is supposed to be the most efficient collection for inverse=true.
- Young
Jon Travis wrote: > Regardless, our XSL translation should not break a perfectly valid > Hibernate file. Since you're the only one here who reads XSL, I'll > leave it to you to fix that bug. > > I'll move my stuff to .hbm files > > -- Jon > > > On Nov 10, 2006, at 12:50 PM, Young Lee wrote: > >> Well, if u do not want xsl processing for the hbm files, then do not >> name it with hq-xml suffix. >> >> - Young >> >> Jon Travis wrote: >>> I've gotten this to work. >>> >>> The bug is a result of the fact that we process our .hq-xml files >>> into .hbm files. It deletes my inverse="true" flag. >>> >>> I would prefer that we DON'T use XSL to process all those files. If >>> you look at the .hbm files, there are a million options that are >>> already used as the default in Hibernate. >>> >>> Look at one of our generated .hbm files. Compare that with anything >>> in the HIbernate documentation. >>> >>> - We don't even know what most of those options do >>> - XSL is currently breaking my code >>> - It's not necessary -- it just adds complexity to our framework & >>> an extra processing step! >>> >>> -- Jon >>> >>> >>> >>> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >>> >>>> Jon, >>>> >>>> I'd recommend that if you are going to use inverse="true" >>>> collections then use inverse bags. one-to-many >>>> inverse=true bag collection use in hq have couple of benefits >>>> >>>> 1. consistency with rest of the object model >>>> 2. the xslt script will inject proper casade options when it >>>> processes the hq-xml into hbm.xml file. >>>> >>>> If you must use sets, then try the same set of cascade options that >>>> we use for bags which is >>>> cascade="save-update,delete,evict,persist,merge" on the set element >>>> and >>>> on-delete="cascade" on the key element in the set. >>>> >>>> - Young >>>> >>>> Jon Travis wrote: >>>>> I think there are still some things wrong with our Hibernate >>>>> framework. >>>>> >>>>> If I write a test-suite that only creates a new Crispo (and >>>>> executes no finders), that object will never get persisted. Only >>>>> if I do a find (and therefore a flush) will it get written out to >>>>> the DB. Possible that the session isn't flushing when coming out >>>>> of the test suite? >>>>> >>>>> Another thing is that I've tried a million different things and am >>>>> still unable to do create an easy cascading relationship between >>>>> Crispo and CrispoOption. all-delete-orphan does not appear to >>>>> work for me, no matter what I do. I've basically even followed >>>>> their example and still couldn't get it to work: >>>>> >>>>> http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html >>>>> >>>>> >>>>> If I delete the parent, Hibernate attempts to set the parent ID of >>>>> the children to null (invalid), then delete the parent. Instead, >>>>> it should perform 2 delete statements. >>>>> >>>>> For the meantime, I'll go ahead and delete all the children >>>>> manually, but this means that we cannot have a cascade from other >>>>> objects to Crispos, since we'll have to invoke the delete method >>>>> manually.. 😞 >>>>> >>>>> -- Jon >>>>> >>>>> >>>>> >>>>> >>> >
all includes cascading lock as well which I don't want cascading. That is why the processing is done in xsl 😉
- young
Jon Travis wrote: > I have no idea why we are putting > cascade="save-update,delete,evict,persist,merge" all over the place. > > This just confuses people. > > 'all' encompasses everything except for delete-orphan. > > For the most part we should be using 'all', 'all-delete-orphan', and > 'save-update' > > Moreover, your suggestion seems way more complex than just using the > recommended pattern from the Hibernate team. It should be rudimentary. > > -- Jon > > > > On Nov 10, 2006, at 11:47 AM, Young Lee wrote: > >> Jon, >> >> I'd recommend that if you are going to use inverse="true" collections >> then use inverse bags. one-to-many >> inverse=true bag collection use in hq have couple of benefits >> >> 1. consistency with rest of the object model >> 2. the xslt script will inject proper casade options when it >> processes the hq-xml into hbm.xml file. >> >> If you must use sets, then try the same set of cascade options that >> we use for bags which is >> cascade="save-update,delete,evict,persist,merge" on the set element and >> on-delete="cascade" on the key element in the set. >> >> - Young >> >> Jon Travis wrote: >>> I think there are still some things wrong with our Hibernate framework. >>> >>> If I write a test-suite that only creates a new Crispo (and executes >>> no finders), that object will never get persisted. Only if I do a >>> find (and therefore a flush) will it get written out to the DB. >>> Possible that the session isn't flushing when coming out of the test >>> suite? >>> >>> Another thing is that I've tried a million different things and am >>> still unable to do create an easy cascading relationship between >>> Crispo and CrispoOption. all-delete-orphan does not appear to work >>> for me, no matter what I do. I've basically even followed their >>> example and still couldn't get it to work: >>> >>> http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html >>> >>> >>> If I delete the parent, Hibernate attempts to set the parent ID of >>> the children to null (invalid), then delete the parent. Instead, it >>> should perform 2 delete statements. >>> >>> For the meantime, I'll go ahead and delete all the children >>> manually, but this means that we cannot have a cascade from other >>> objects to Crispos, since we'll have to invoke the delete method >>> manually.. 😞 >>> >>> -- Jon >>> >>> >>> >>> >
> all includes cascading lock as well which I don't want cascading. > That is why the processing is done in xsl 😉 > > - young > > Jon Travis wrote: >> I have no idea why we are putting cascade="save- >> update,delete,evict,persist,merge" all over the place. >> >> This just confuses people. >> >> 'all' encompasses everything except for delete-orphan. >> >> For the most part we should be using 'all', 'all-delete-orphan', >> and 'save-update' >> >> Moreover, your suggestion seems way more complex than just using >> the recommended pattern from the Hibernate team. It should be >> rudimentary. >> >> -- Jon >> >> >> >> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >> >>> Jon, >>> >>> I'd recommend that if you are going to use inverse="true" >>> collections then use inverse bags. one-to-many >>> inverse=true bag collection use in hq have couple of benefits >>> >>> 1. consistency with rest of the object model >>> 2. the xslt script will inject proper casade options when it >>> processes the hq-xml into hbm.xml file. >>> >>> If you must use sets, then try the same set of cascade options >>> that we use for bags which is >>> cascade="save-update,delete,evict,persist,merge" on the set >>> element and >>> on-delete="cascade" on the key element in the set. >>> >>> - Young >>> >>> Jon Travis wrote: >>>> I think there are still some things wrong with our Hibernate >>>> framework. >>>> >>>> If I write a test-suite that only creates a new Crispo (and >>>> executes no finders), that object will never get persisted. >>>> Only if I do a find (and therefore a flush) will it get written >>>> out to the DB. Possible that the session isn't flushing when >>>> coming out of the test suite? >>>> >>>> Another thing is that I've tried a million different things and >>>> am still unable to do create an easy cascading relationship >>>> between Crispo and CrispoOption. all-delete-orphan does not >>>> appear to work for me, no matter what I do. I've basically even >>>> followed their example and still couldn't get it to work: >>>> http://www.hibernate.org/hib_docs/reference/en/html/example- >>>> parentchild.html >>>> >>>> If I delete the parent, Hibernate attempts to set the parent ID >>>> of the children to null (invalid), then delete the parent. >>>> Instead, it should perform 2 delete statements. >>>> >>>> For the meantime, I'll go ahead and delete all the children >>>> manually, but this means that we cannot have a cascade from >>>> other objects to Crispos, since we'll have to invoke the delete >>>> method manually.. 😞 >>>> >>>> -- Jon >>>> >>>> >>>> >>>> >>
First, we use optimistic locking so we should not even need to worry about about hibernate initiated pessimistic locks cascading. Declaring cascade in this manner just ensures that hibernate initiated pessimistic locks are not cascaded. BTW use of pessimistic locks should strongly be discouraged.
- Young
Jon Travis wrote: > Why don't you want lock cascading? > > -- Jon > > > On Nov 10, 2006, at 1:03 PM, Young Lee wrote: > >> all includes cascading lock as well which I don't want cascading. >> That is why the processing is done in xsl 😉 >> >> - young >> >> Jon Travis wrote: >>> I have no idea why we are putting >>> cascade="save-update,delete,evict,persist,merge" all over the place. >>> >>> This just confuses people. >>> >>> 'all' encompasses everything except for delete-orphan. >>> >>> For the most part we should be using 'all', 'all-delete-orphan', and >>> 'save-update' >>> >>> Moreover, your suggestion seems way more complex than just using the >>> recommended pattern from the Hibernate team. It should be rudimentary. >>> >>> -- Jon >>> >>> >>> >>> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >>> >>>> Jon, >>>> >>>> I'd recommend that if you are going to use inverse="true" >>>> collections then use inverse bags. one-to-many >>>> inverse=true bag collection use in hq have couple of benefits >>>> >>>> 1. consistency with rest of the object model >>>> 2. the xslt script will inject proper casade options when it >>>> processes the hq-xml into hbm.xml file. >>>> >>>> If you must use sets, then try the same set of cascade options that >>>> we use for bags which is >>>> cascade="save-update,delete,evict,persist,merge" on the set element >>>> and >>>> on-delete="cascade" on the key element in the set. >>>> >>>> - Young >>>> >>>> Jon Travis wrote: >>>>> I think there are still some things wrong with our Hibernate >>>>> framework. >>>>> >>>>> If I write a test-suite that only creates a new Crispo (and >>>>> executes no finders), that object will never get persisted. Only >>>>> if I do a find (and therefore a flush) will it get written out to >>>>> the DB. Possible that the session isn't flushing when coming out >>>>> of the test suite? >>>>> >>>>> Another thing is that I've tried a million different things and am >>>>> still unable to do create an easy cascading relationship between >>>>> Crispo and CrispoOption. all-delete-orphan does not appear to >>>>> work for me, no matter what I do. I've basically even followed >>>>> their example and still couldn't get it to work: >>>>> >>>>> http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html >>>>> >>>>> >>>>> If I delete the parent, Hibernate attempts to set the parent ID of >>>>> the children to null (invalid), then delete the parent. Instead, >>>>> it should perform 2 delete statements. >>>>> >>>>> For the meantime, I'll go ahead and delete all the children >>>>> manually, but this means that we cannot have a cascade from other >>>>> objects to Crispos, since we'll have to invoke the delete method >>>>> manually.. 😞 >>>>> >>>>> -- Jon >>>>> >>>>> >>>>> >>>>> >>> >
A 'Set' is the correct model for my data in this case.
BTW: The system does not support using .hbm files, so I've added that to the framework.
-- Jon
On Nov 10, 2006, at 1:02 PM, Young Lee wrote:
> do u have to use a set for inverse=true? can u use bag instead? > bag is supposed to be the most efficient collection for inverse=true. > > - Young > > Jon Travis wrote: >> Regardless, our XSL translation should not break a perfectly valid >> Hibernate file. Since you're the only one here who reads XSL, >> I'll leave it to you to fix that bug. >> >> I'll move my stuff to .hbm files >> >> -- Jon >> >> >> On Nov 10, 2006, at 12:50 PM, Young Lee wrote: >> >>> Well, if u do not want xsl processing for the hbm files, then do >>> not name it with hq-xml suffix. >>> >>> - Young >>> >>> Jon Travis wrote: >>>> I've gotten this to work. >>>> >>>> The bug is a result of the fact that we process our .hq-xml >>>> files into .hbm files. It deletes my inverse="true" flag. >>>> >>>> I would prefer that we DON'T use XSL to process all those >>>> files. If you look at the .hbm files, there are a million >>>> options that are already used as the default in Hibernate. >>>> >>>> Look at one of our generated .hbm files. Compare that with >>>> anything in the HIbernate documentation. >>>> >>>> - We don't even know what most of those options do >>>> - XSL is currently breaking my code >>>> - It's not necessary -- it just adds complexity to our framework >>>> & an extra processing step! >>>> >>>> -- Jon >>>> >>>> >>>> >>>> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >>>> >>>>> Jon, >>>>> >>>>> I'd recommend that if you are going to use inverse="true" >>>>> collections then use inverse bags. one-to-many >>>>> inverse=true bag collection use in hq have couple of benefits >>>>> >>>>> 1. consistency with rest of the object model >>>>> 2. the xslt script will inject proper casade options when it >>>>> processes the hq-xml into hbm.xml file. >>>>> >>>>> If you must use sets, then try the same set of cascade options >>>>> that we use for bags which is >>>>> cascade="save-update,delete,evict,persist,merge" on the set >>>>> element and >>>>> on-delete="cascade" on the key element in the set. >>>>> >>>>> - Young >>>>> >>>>> Jon Travis wrote: >>>>>> I think there are still some things wrong with our Hibernate >>>>>> framework. >>>>>> >>>>>> If I write a test-suite that only creates a new Crispo (and >>>>>> executes no finders), that object will never get persisted. >>>>>> Only if I do a find (and therefore a flush) will it get >>>>>> written out to the DB. Possible that the session isn't >>>>>> flushing when coming out of the test suite? >>>>>> >>>>>> Another thing is that I've tried a million different things >>>>>> and am still unable to do create an easy cascading >>>>>> relationship between Crispo and CrispoOption. all-delete- >>>>>> orphan does not appear to work for me, no matter what I do. >>>>>> I've basically even followed their example and still couldn't >>>>>> get it to work: >>>>>> http://www.hibernate.org/hib_docs/reference/en/html/example- >>>>>> parentchild.html >>>>>> >>>>>> If I delete the parent, Hibernate attempts to set the parent >>>>>> ID of the children to null (invalid), then delete the parent. >>>>>> Instead, it should perform 2 delete statements. >>>>>> >>>>>> For the meantime, I'll go ahead and delete all the children >>>>>> manually, but this means that we cannot have a cascade from >>>>>> other objects to Crispos, since we'll have to invoke the >>>>>> delete method manually.. 😞 >>>>>> >>>>>> -- Jon >>>>>> >>>>>> >>>>>> >>>>>> >>>> >>
I do, however think that our hibernate files should be simple to read and understand. Right now that is certainly not the case. People type one thing, and it gets munged into something else that they don't understand (and in my case, totally incorrect.)
As for the locking -- using 'all' is easy, and by using <version> tags, we are already stating that we want optimistic locking.
Can't we just go with something that's easy to read and concise?
I guarantee if people read our generated .hbm files, they'll be very confused as to what is actually going on. That's not going to make getting Hibernate support any easier.
-- Jon
On Nov 10, 2006, at 1:17 PM, Young Lee wrote:
> First, we use optimistic locking so we should not even need to > worry about about hibernate initiated pessimistic locks cascading. > Declaring cascade in this manner just ensures that hibernate > initiated pessimistic locks are not cascaded. BTW use of > pessimistic locks should strongly be discouraged. > > - Young > > > > Jon Travis wrote: >> Why don't you want lock cascading? >> >> -- Jon >> >> >> On Nov 10, 2006, at 1:03 PM, Young Lee wrote: >> >>> all includes cascading lock as well which I don't want >>> cascading. That is why the processing is done in xsl 😉 >>> >>> - young >>> >>> Jon Travis wrote: >>>> I have no idea why we are putting cascade="save- >>>> update,delete,evict,persist,merge" all over the place. >>>> >>>> This just confuses people. >>>> >>>> 'all' encompasses everything except for delete-orphan. >>>> >>>> For the most part we should be using 'all', 'all-delete-orphan', >>>> and 'save-update' >>>> >>>> Moreover, your suggestion seems way more complex than just using >>>> the recommended pattern from the Hibernate team. It should be >>>> rudimentary. >>>> >>>> -- Jon >>>> >>>> >>>> >>>> On Nov 10, 2006, at 11:47 AM, Young Lee wrote: >>>> >>>>> Jon, >>>>> >>>>> I'd recommend that if you are going to use inverse="true" >>>>> collections then use inverse bags. one-to-many >>>>> inverse=true bag collection use in hq have couple of benefits >>>>> >>>>> 1. consistency with rest of the object model >>>>> 2. the xslt script will inject proper casade options when it >>>>> processes the hq-xml into hbm.xml file. >>>>> >>>>> If you must use sets, then try the same set of cascade options >>>>> that we use for bags which is >>>>> cascade="save-update,delete,evict,persist,merge" on the set >>>>> element and >>>>> on-delete="cascade" on the key element in the set. >>>>> >>>>> - Young >>>>> >>>>> Jon Travis wrote: >>>>>> I think there are still some things wrong with our Hibernate >>>>>> framework. >>>>>> >>>>>> If I write a test-suite that only creates a new Crispo (and >>>>>> executes no finders), that object will never get persisted. >>>>>> Only if I do a find (and therefore a flush) will it get >>>>>> written out to the DB. Possible that the session isn't >>>>>> flushing when coming out of the test suite? >>>>>> >>>>>> Another thing is that I've tried a million different things >>>>>> and am still unable to do create an easy cascading >>>>>> relationship between Crispo and CrispoOption. all-delete- >>>>>> orphan does not appear to work for me, no matter what I do. >>>>>> I've basically even followed their example and still couldn't >>>>>> get it to work: >>>>>> http://www.hibernate.org/hib_docs/reference/en/html/example- >>>>>> parentchild.html >>>>>> >>>>>> If I delete the parent, Hibernate attempts to set the parent >>>>>> ID of the children to null (invalid), then delete the parent. >>>>>> Instead, it should perform 2 delete statements. >>>>>> >>>>>> For the meantime, I'll go ahead and delete all the children >>>>>> manually, but this means that we cannot have a cascade from >>>>>> other objects to Crispos, since we'll have to invoke the >>>>>> delete method manually.. 😞 >>>>>> >>>>>> -- Jon >>>>>> >>>>>> >>>>>> >>>>>> >>>> >>