Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Aristedes Maniatis
On 12/03/2009, at 9:04 AM, Francisco Peredo wrote: Hi!I really wonder why nobody has built something like Cayenne on top of JPA, I mean, it should be clear that Cayenne is higher level API that offers a lot of advantages.. Andrus has already spent a vast amount of time on moving Cayenne

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Francisco Peredo
Hi!I really wonder why nobody has built something like Cayenne on top of JPA, I mean, it should be clear that Cayenne is higher level API that offers a lot of advantages...I have another question: when using in Cayenne JPA api... after you call entityManager.persist(object)... in what state is the

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Francisco Peredo
Nope, it does not have anything like it. JbossSeam does support nested conversations, but since the underlying ORM (Hibernate) has no support for anything like it, there is a kind of "impedance mismatch" that makes nested conversations very unusable (even the Seam experts use nested conversation o

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Robert Zeigler
Support for nested contexts: yes. (Although I'm pretty sure that the newest versions of hibernate have nested sessions? Haven't played with them, though). Inheritance: someone who has worked on the issue will have to comment. Various stops and starts have been made, and I haven't followed the

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Francisco Peredo
Hi! Thanks a lot for your answers Robert and Mike, Robert was right, I was looking for short term/ temporary pk that can be apparently be obtained with obj.getObjectId() for cases where the object has not been persisted in to the database. Seems like Cayenne could be a better fit for the way my

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Michael Gentry
Hi Robert, I was just guessing that since Francisco wanted to be able to display the "temporary ID" on the user interface that there might be an expectation (on the user's part?) of being able to write it down/etc and query for it later. Like a tracking number of some kind. Either way, I hope hi

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Robert Zeigler
Interesting to see the comments coming from a hibernate + cayenne user (me) vs. an EOF + cayenne user (Mike). :) Just wanted to follow up on the question and comment below: Cayenne doesn't really have this, either. (Neither does EOF.) You have to commit to have the PKs assigned (unless you

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Michael Gentry
Comments inline ... On Wed, Mar 11, 2009 at 4:06 PM, Francisco Peredo wrote: > > Hi! Hi Francisco. > My first contact with an ORM was EOF... an ever since I have felt that > nothing compares to it ;-). I'm still doing WebObjects/EOF and have a decent idea about how the two frameworks compa

Re: Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Robert Zeigler
On Mar 11, 2009, at 3/113:06 PM , Francisco Peredo wrote: Hi! My first contact with an ORM was EOF... an ever since I have felt that nothing compares to it ;-). The thing is, I have had to work with JPA/Hibernate for a few years now... and I feel it has some weaknesses I really do not like,

Coming from EOF: Cayenne vs Hibernate

2009-03-11 Thread Francisco Peredo
Hi! My first contact with an ORM was EOF... an ever since I have felt that nothing compares to it ;-). The thing is, I have had to work with JPA/Hibernate for a few years now... and I feel it has some weaknesses I really do not like, I am thinking about "switching to cayenne" but first i would li

Re: How can I handle validation exception?

2009-03-11 Thread Andrus Adamchik
On Mar 11, 2009, at 11:01 AM, Νίκος Παράσχου wrote: Is there any way to do something like the following: try { context.commitChanges(); } catch(Some ValidationException thrown earlier) { // Get failures list and print error messages. } This is how it should be done, and this

Re: How can I handle validation exception?

2009-03-11 Thread Νίκος Παράσχου
The following code works fine: context.setValidatingObjectsOnCommit(false); ValidationResult validationResult = new ValidationResult(); company.validateForInsert(validationResult); if(validationResult.hasFailures()) { List failures = validationResult.g

Re: How can I handle validation exception?

2009-03-11 Thread Andrus Adamchik
Is the following correct? Looks about right. Also there's a few pre-canned classes implementing ValidationFailure in the org.apache.cayenne.validation package that can be used to build failures. Or how can I retrieve the error message from the validationResult when a ValidationException

Re: How can I handle validation exception?

2009-03-11 Thread Νίκος Παράσχου
Thank you Andrus, Yes, I do not throw the exception myself. But, how am I going to handle the exception thrown by Cayenne? Or how can I retrieve the error message from the validationResult when a ValidationException is thrown, so that I can print it in the GUI? Is the following correct? @Ove