If you wan't have problem with lazy loading, N+1; you must write a custom
jpaql query to fetch the properties do you need. You have N queries, so q1
fetch X properties, q2 Y properties. This is the way I found to resolve the
problems that you mark with JPA.

Always you will final must tunning your queries when have a lot of data.

Juan



2011/9/12 Juan Pablo Gardella <[email protected]>

> jdbc
>
> 2011/9/12 Jens <[email protected]>
>
>> In a current project I use JPA for persistence. JPA works and you can have
>> a fast start with it but it has its pitfalls.
>> For example having lazy attributes sounds nice but as soon as you have
>> more complex logic and queries you want to fetch these properties eagerly to
>> avoid hundreds of querys (N+1 for collections). But you can not make
>> everything eagerly because then simple queries would fetch lots of data that
>> is not needed at all. So you have to use JOIN FETCH but thats not defined
>> for multiple tiers/properties in the JPA spec. So you end up using vendor
>> specific features and its not that nice anymore to use JPA.
>> Also if anything gets wrong with your queries its hard to debug the
>> internals of JPA.
>>
>> So I wonder if there are any nice alternatives to JPA?
>>
>> What do you guys use for persistence assuming you can not use AppEngine
>> and thus Objectify?
>>
>> -- J.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-web-toolkit/-/qvOQ0Ln1sQIJ.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to