[Lift] Re: [scala] JPA question

2009-06-24 Thread TSP
Derek Would you distinguish between what is achievable in a specific ORM such as Hibernate from JPA in this statement or would you think it applies to all. I've got to go with hibernate in any case because of widespread use of UserTypes. Unlike Greg, in my case I can hand-craft all my hibernate

[Lift] Re: [scala] JPA question

2009-06-24 Thread Derek Chen-Becker
Well, in my real-world experience I've never had very complex models and I've never used TABLE-PER-CLASS either, so I don't really have a feel for what's not possible. Generally I think that JPA (which is a subset of Hibernate) covers a good portion of people's needs for ORM, but it definitely has

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Derek, i completely concur. i wanted to give it a serious go, however, before i abandoned it. The issue is that so much of the incumbent technology goes across this object-relational boundary, i needed a simple case to justify walking away from this technology. This example provides it. To see

[Lift] Re: [scala] JPA question

2009-06-23 Thread Kris Nuttycombe
Oops, forgot a member of the hierarchy, inline below: On Tue, Jun 23, 2009 at 3:19 PM, Kris Nuttycombekris.nuttyco...@gmail.com wrote: I'm just so puzzled by this thread because I have the following entity hierarchy in my app: @Entity @Inheritance(strategy = InheritanceType.JOINED)

[Lift] Re: [scala] JPA question

2009-06-23 Thread Kris Nuttycombe
I'm just so puzzled by this thread because I have the following entity hierarchy in my app: @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = payment_source_transaction) public abstract class PaymentSourceTransactionT extends PaymentSourceT extends

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Kris, Thanks for this code sample. i will study and see if it offers a way around the conundrum. In the meantime, here's a code samplehttp://svn.biosimilarity.com/src/open/codesamples/trunk/hibernate/hbex/illustrating exactly what i'm talking about. Best wishes, --greg On Tue, Jun 23, 2009 at

[Lift] Re: [scala] JPA question

2009-06-23 Thread Oliver Lambert
I don't understand from the code sample why AbstractContainer has to be an entity or have a table or id annotation. I'd be looking at just using the @MappedSuperclass annotation. On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory lgreg.mered...@gmail.comwrote: Kris, Thanks for this code

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Kris, Do you have a self-contained, compilable sample i could compare to the one i made? i can craft one from your snippet below, but it'd be a better comparison if you had one already. Best wishes, --greg On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe kris.nuttyco...@gmail.comwrote:

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Oliver, Thanks. This proposal has been put forward before. - The code is generated. If the top class is annotated @MappedSuperclass, why not label every abstract class that is top of its hierarchy @MappedSuperclass. That's the simplest change to the compilation strategy that

[Lift] Re: [scala] JPA question

2009-06-23 Thread Oliver Lambert
Actually, I don't think I would be looking at @MappedSuperclass either. Whats your database schema? Is it always a Legacy database or are you creating it new? Are the java entities you are trying to create, read only? Why aren't you using Scala's JPA? If you are creating a complex parent-child

[Lift] Re: [scala] JPA question

2009-06-22 Thread Meredith Gregory
Kris, Thanks for the suggestion. i've now got a tiny little example that compiles on its own that illustrates the problem. Changing the inheritance strategy to JOINED makes no difference. Hibernate still does the wrong thing. Best wishes, --greg On Mon, Jun 22, 2009 at 8:55 AM, Kris Nuttycombe

[Lift] Re: [scala] JPA question

2009-06-22 Thread Meredith Gregory
Kris, Here http://svn.biosimilarity.com/src/open/codesamples/trunk/hibernate/ is a link to the self-contained example that now uses just Java. i included the target dir in the repo to speed up investigation, but you can just blow that away and build from scratch. The example is currently written

[Lift] Re: [scala] JPA question

2009-06-22 Thread Derek Chen-Becker
Something I just want to throw out into the discussion: Since you're using table-per-class, having a @Table annotation on AbstractContainer doesn't do anything since abstract classes can't have instances. Tables are only generated for abstract classes if you're using a JOINED inheritance strategy.

[Lift] Re: [scala] JPA question

2009-06-22 Thread Meredith Gregory
Derek, You are correct and i noted and reported this on Scala on Friday. However, if you have a chain of the form AbstractClass - Class -contains- AbstractClass -Class -contains- ... The @MappedSuperclass solution fails at level 2. Best wishes, --greg On Mon, Jun 22, 2009 at 3:52 PM, Derek

[Lift] Re: [scala] JPA question

2009-06-22 Thread Meredith Gregory
P.S. While i am waiting for the Hibernate folks to respond to the issue, i am looking into Stefan Zeiger's LINQ implementation for Scala more seriously. If it is reasonably stable, this is a much better target for my compilation scheme, anyway. On Mon, Jun 22, 2009 at 3:55 PM, Meredith Gregory

[Lift] Re: [scala] JPA question

2009-06-22 Thread Derek Chen-Becker
Ah, sorry, I lost track of the thread. On Mon, Jun 22, 2009 at 4:55 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: Derek, You are correct and i noted and reported this on Scala on Friday. However, if you have a chain of the form AbstractClass - Class -contains- AbstractClass -Class

[Lift] Re: [scala] JPA question

2009-06-22 Thread Derek Chen-Becker
For sufficiently complex relationships, JPA is not a good fit. Beyond a certain point it's usually simpler to roll your own. I think that this is somewhat of a failing of the model, but it's not a simple problem to solve in the generic case. Derek On Mon, Jun 22, 2009 at 6:45 PM, Derek