I'm sorry to say that we didn't actually get to do QBE in JPA 2.0. Criteria API does not have any special operators for it so entity equality is just like in JP QL, based on PK value. Sorry, but hopefully we'll be more successful on that front in the next go-round. For now it is one of those vendor features that every vendor supports, but is not in the spec yet.

Mike Keith wrote:I'm sorry to say that we didn't actually get to do QBE in JPA 2.0. Criteria API does not have any special operators for it so entity equality is just like in JP QL, based on PK value. Sorry, but hopefully we'll be more successful on that front in the next go-round. For now it is one of those vendor features that every vendor supports, but is not in the spec yet.

Really, I kind of assumed if there was a Criteria object here was QBE. ;)

Mark

Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211

posted Mar 10, 2010 22:12:19

0

Mike Keith wrote:I'm sorry to say that we didn't actually get to do QBE in JPA 2.0. Criteria API does not have any special operators for it so entity equality is just like in JP QL, based on PK value. Sorry, but hopefully we'll be more successful on that front in the next go-round. For now it is one of those vendor features that every vendor supports, but is not in the spec yet.

Ok, well I think you can give sample code for QBE in JPA 2.0 on web-page dedicated for the book. I am sure this feature comes among the most sought after ones in ORM community.

Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304

posted Mar 11, 2010 07:07:07

0

We have tried to keep the book focused on the specification. Since this is a vendor feature then vendor documentation will generally cover this. If you really want a code example that uses QBE, though, here is a sample of using it in the EclipseLink JPA 2.0 reference implementation:

Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211

posted Mar 11, 2010 09:56:36

0

Mike Keith wrote:We have tried to keep the book focused on the specification. Since this is a vendor feature then vendor documentation will generally cover this. If you really want a code example that uses QBE, though, here is a sample of using it in the EclipseLink JPA 2.0 reference implementation:

Thanks for the code. It looks like there's no vendor neutral way to achieve it.