Adding *hibernate.show_sql=true* and *hibernate.format_sql=true* to *system.properties* did the trick
Thank you all 2015-07-17 14:05 GMT-03:00 Yann Blazart <yann.blaz...@bycode.fr>: > And yes that's working too, but only for TomEE ;) > > I'm using this in my "units" tests with app composer (thanks Romain !) > > Well I'd just put the properties I want in conf/system.properties. > > Side note: if you want to do it by persistence unit you can as well > > prefixing it by PERSISTENCEUNIT and the unit name as explained here > > http://tomee.apache.org/properties-listing.html > > > 2015-07-17 18:28 GMT+02:00 Romain Manni-Bucau <rmannibu...@gmail.com>: > > > Well I'd just put the properties I want in conf/system.properties. > > > > Side note: if you want to do it by persistence unit you can as well > > prefixing it by PERSISTENCEUNIT and the unit name as explained here > > http://tomee.apache.org/properties-listing.html > > > > > > > > Romain Manni-Bucau > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > <http://rmannibucau.wordpress.com> | Github < > > https://github.com/rmannibucau> | > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber > > <http://www.tomitribe.com> > > > > 2015-07-17 7:52 GMT-07:00 Daniel Cunha <daniels...@gmail.com>: > > > > > If I get it.. > > > > > > You need to have something like DeltaSpike ProjectStage[1] where you > > have a > > > configuration for Development and another configuration for Production. > > > > > > So, maybe you can create a different Produce for each stage. > > > > > > Then with Alternative and Exclude annotations you can configure it. > > > I'm not expert in this module of the DeltaSpike, but.. I think that it > > can > > > be very useful for you. :) > > > > > > If TomEE have some solution, really.. I don't know. :( > > > > > > [1] > > > > > > http://deltaspike.apache.org/documentation/core.html#Type-safeProjectStage > > > > > > On Fri, Jul 17, 2015 at 10:55 AM, Felipe Jaekel <fkjae...@gmail.com> > > > wrote: > > > > > > > Hi, > > > > > > > > Persistence is working fine... > > > > > > > > My demand is to enable hibernate's generated sql output only when the > > > > webapp is running locally. > > > > > > > > persistence.xml is not an option because I cannot afford to forget > this > > > > setting enabled and send the webapp to production with it, since the > > > server > > > > will run out of disk space in a few days because of the very fast > > growth > > > of > > > > the log files. > > > > > > > > When I migrated my webapp to TomEE I started to use the injected > > > > EntityManagerFactory that was already created, so I can't pass a map > of > > > > properties to it like I used to do in Tomcat. > > > > > > > > I'd like to know if is it possible to intercept TomEE's > > > > EntityManagerFactory creation. > > > > > > > > Thanks > > > > > > > > > > > > 2015-07-15 14:45 GMT-03:00 Daniel Cunha <daniels...@gmail.com>: > > > > > > > > > Hi Felipe, > > > > > > > > > > you can inject EntityManager with @PersistenceContext > > > > > < > > > > > > > > > > > > > > > http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html > > > > > > > > > > > Configure your persistence like this persistence.xml > > > > > < > > > > > > > > > > > > > > > https://github.com/apache/tomee/blob/master/examples/jpa-hibernate/src/main/resources/META-INF/persistence.xml > > > > > > > > > > > > > > > > Inject your EntityManager like this: > > > > > > > > > > > > > > > > > > > > https://github.com/apache/tomee/blob/master/examples/jpa-hibernate/src/main/java/org/superbiz/injection/h3jpa/Movies.java#L29-L30 > > > > > > > > > > See the sample (try running, test and explore it): > > > > > https://github.com/apache/tomee/tree/master/examples/jpa-hibernate > > > > > > > > > > > > > > > On Wed, Jul 15, 2015 at 2:36 PM, Felipe Jaekel <fkjae...@gmail.com > > > > > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I need to enable Hibernate SQL output only when my webapp in > > running > > > on > > > > > my > > > > > > dev environment. > > > > > > > > > > > > On Tomcat since I could do something like this: > > > > > > > > > > > > > > > > > > Map<String, String> properties = new HashMap<String, String>(); > > > > > > > if(ServerUtil.isLocal()) > > > > > > > { > > > > > > > properties.put("hibernate.show_sql", "true"); > > > > > > > properties.put("hibernate.format_sql", "true"); > > > > > > > } > > > > > > > emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT, > > > > > > properties); > > > > > > > > > > > > > > > > > > > > > > > > Is there any way I can do something similar with the injected > > > > > > EntityManagerFactory on TomEE? > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Best regard, > > > > > Daniel Cunha (soro) > > > > > > > > > > > > > > > > > > > > > -- > > > Best regard, > > > Daniel Cunha (soro) > > > > > >