From: Jon L. <jon...@xe...> - 2002-05-15 10:10:27
|
I had the same idea for the syntax, but I wanted to make sure you agreed with that before I dove in and started working on it. As a quick hack just to get my app up and running I patched Hibernate to allow me to queries like: from foo in class eg.Foo where foo.subid = 69 However I didn't feel like this was an accurate representation of the object relationships so I now I'd like to do it right. It might take a few days to implement this since I'm in the middle of another project, but since I need this in quite a few places I am motivated to implement this. Cheers, Jon... ----- Original Message ----- From: <Gavin_King/Cirrus%CI...@ci...> To: "Jon Lipsky" <jon...@xe...> Cc: <hib...@li...> Sent: Wednesday, May 15, 2002 11:46 AM Subject: Re: [Hibernate-devel] Queries on objects with composite keys... > > > >> I am correct in my findings that you cannot currently do queries based > on composite keys where you only want to select using only 1 of the > composite key properties? The only way currently supported is to do a > "find" for the object using the composite key object, right? > > Yeah, thats about right. Nor can you frame queries that would require a > table join on the composite key. > > >> I ended up patching Hibernate so you can do a select based on the > composite key, however I think the way I did it is only valid as a > temporary solution. I would be willing to work on adding complete query > support for composite keys if anyone else thinks there is demand for this. > > Sounds great! Any work you could do in this area is _much_ > appreciated!Exactly what are you proposing? I'm thinking a syntax something > like: > > from foo in class eg.Foo where foo.id.subid = 69 > > where id is the composite identifier of eg.Foo. > > I apologise for all the hand-written parsing code for the query language. I > knew zero about lexing + parsing at the time so I ended up doing by hand > what I should have used ANTLR for. It was my intention to reimplement the > query language using an antlr grammar I wrote later. (Yeah, I educated > myself since.) However, since this is the very first feature request to do > with queries, I'm now inclined to leave alone a feature that seems to be > serving everyone quite well :) > > Thanks for the offer of help > > peace > > Gavin > |