Re: JpaPersistModule, Hibernate and URL Variables

2018-02-15 Thread Evan Ruff
I mean, sure you could, but I don't like to put the business login in my Bootstrap too much. It just felt cleaner the way I did it. I have defaults, logging, failover, warnings etc if the environment isn't setup quite the way I think it should be. On Thursday, February 15, 2018 at 8:50:51 AM

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-15 Thread Stephan Classen
Can't you simply do the following?? public class MyModule extends ServletModule {   protected void configureServlets() {     install(new JpaPersistModule("myJpaUnit").setProperties(myProperties));   } } On 15.02.2018 14:46, Evan Ruff wrote: scl, Thanks for the tip, this works as expected.

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-15 Thread Evan Ruff
scl, Thanks for the tip, this works as expected. JpaPersistModule is final (ARGH) but I created a static utility class with an install method that handles it. I build the database connection string using the env props and then I'm able to set it using the JpaPersistModule.properties( prop )

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-15 Thread Stephan Classen
Only way you can try to achieve this is the methode: JpaPersistModule.setProperties() The properties passed in will be used to create the entity manager factory (see JpaPersistService.start()) Maybe you can overwrite the URL in the properties you pass. On 15.02.2018 12:05, Evan Ruff wrote:

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-15 Thread Evan Ruff
I'd really like to be able to define the location of the DB, as multiple services will be accessing it. I'm okay with moving away from the persistence.xml file and rolling the configuration in code, but I'm not sure where to do that while still using JpaPersistModule. Has anyone tried a

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-14 Thread Stephan Classen
Maybe you can make your path relative to the user directory as described here: http://www.h2database.com/html/faq.html#database_files Am 14. Februar 2018 21:06:34 MEZ schrieb Evan Ruff : >Hey guys, > >So I'm actually just letting Guice Persist pull it straight out of

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-14 Thread Evan Ruff
Hey guys, So I'm actually just letting Guice Persist pull it straight out of META-INF/persistence.xml file. I'm wondering where I can either change the URL or set it explicitly, while still using Guice Persist. thanks! E On Wednesday, February 14, 2018 at 10:58:11 AM UTC-5, Sondre

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-14 Thread Sondre Bjornebekk
If you always want to use h2, you could just simply build the string using https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#getenv--? If you wanted to inject different JPA providers, you could certainly use Guice for that (since you posted here) - I have a HibernateSessionFactory

Re: JpaPersistModule, Hibernate and URL Variables

2018-02-14 Thread Stephan Classen
When are you passing this string? Is it part of you Giuce Module?? Could you read the environment variable before creating the string and than manually create the URL string? On 14.02.2018 11:38, Evan Ruff wrote: Hey guys, I've got what I think is a pretty straightforward task but I'm