somoso / vaadin-appfoundation

Automatically exported from code.google.com/p/vaadin-appfoundation
0 stars 0 forks source link

JPA - do a native query #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all :)

Thank you for AppFoundation, it rocks !

I need to do native query (for calling a database procedure or for 
performance). Is it possible to add a method in the IFacade interface for that?
EntityManager provides the method "createNativeQuery" to do that...

Thanks in advance
best regards,
JBrek

Original issue reported on code.google.com by jbrechbu...@gmail.com on 18 Nov 2010 at 1:47

GoogleCodeExporter commented 9 years ago
Thanks for the feedback :) However, I don't believe this belongs in the 
IFacade. I try to keep the interface as clean as possible. This doesn't mean 
that you couldn't use the createNativeQuery. Just create your own facade which 
extends the JPAFacade, the getEntityManager() method is protected, so you can 
access it in your subclass. Should be quite an easy and straightforward 
solution. Just remember that when you register your own custom facade, you need 
to provide your facade's class to the registerFacade method. 

public static void registerFacade(Class<? extends IFacade> facade, String name, 
boolean isDefault)

If there is something that hinders you from making your own implementation 
(such as some critical method being private), please file a new issua of that.

Sincerely,
Kim

Original comment by kimp...@gmail.com on 20 Nov 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Thank you for your fast answer. 
I created my own facade which extends the JPAFacade class et it works perfectly.

Best regards,
Jachen

Original comment by jbrechbu...@gmail.com on 10 Dec 2010 at 10:44