Questions tagged [guice-persist]

Guice Persist provides abstractions for working with datastores and persistence providers in Guice applications. It works in a normal Java desktop or server application, inside a plain Servlet environment, or even a Java EE container.

Guice Persist provides abstractions for working with datastores and persistence providers in your Guice applications. It works in a normal Java desktop or server application, inside a plain Servlet environment, or even a Java EE container.

Guice Persist supports a simple approach to transactions and various unit-of-work semantics; both with the same declarative, annotation-based API. Switching between unit-of-work strategies is as simple as changing a configuration option.

It also follows the Guice idioms of using simple, expressive configuration and tries to remain type-safe as far as possible.

http://code.google.com/p/google-guice/wiki/GuicePersist

55 questions
19
votes
4 answers

Does Guice Persist provide transaction scoped or application managed EntityManager?

We use Guice Persist to inject EntityManager in our project. E.g. public class MyDao{ @Inject EntityManager em; public void someMethod(){ //uses em instance } } But it is unclear for us how injected instance of EntityManager is…
Piotr Sobczyk
  • 6,015
  • 6
  • 42
  • 65
6
votes
1 answer

Configure HikariCP + Hibernate + GuicePersist(JPA) at Runtime

I have a java8 desktop app using GuicePersist, Hibernate, and HikariCP to communicate with a Postgres DB. I've had success getting my app to send/receive data to the DB using this META-INF/persistence.xml:
Ten_Ten_Steve
  • 321
  • 1
  • 6
  • 16
6
votes
1 answer

jpa2 reuses entityManager with guice

I have a web application that has some strange behavior where I can't really put my finger on. The core of my problem is that there is an inconsistent behavior in the values returned by my rest endpoints. When I start my application, my query…
jelle
  • 750
  • 7
  • 22
5
votes
1 answer

Guice Provider vs EntityManager

I was trying to get simple webapp working with Guice and JPA on Jetty, using the persistence and servlet guice extensions. I have written this Service implementation class: public class PersonServiceImpl implements PersonService { private…
Bennyz
  • 603
  • 2
  • 17
  • 36
5
votes
2 answers

@Transactional annotation not starting transaction (Guice Persist)

I am trying to create a simple service class with a @Transactional annotated method using Guice Persist: public class TestServiceImpl implements TestService { @Inject private Provider entityManager; @Override …
uldall
  • 2,289
  • 1
  • 14
  • 29
5
votes
1 answer

Hibernate 4 connection.autocommit=false ignored

We have an application using Java, hibernate 4, guice 3, guice-persist 3 on tomcat 6 connection.autocommit is configured to false in the hibernate.cfg.xml file:
cporte
  • 2,071
  • 3
  • 17
  • 30
4
votes
0 answers

guice JpaPersistModule with runtime configuration

I need to share datasource with JpaPersistModule. This datasource is provided by guice injector. Now the problem I have to build module during configuration phase, but datasource is available only in runtime. Currently I have following code: public…
michael nesterenko
  • 13,240
  • 23
  • 104
  • 175
4
votes
4 answers

JPA on Google App Engine: When calling persist(...), does it always happen in a transaction?

In my application I am persisting an entity that has a number of unowned children. It seems that the call to persist which does the persisting of the entity and all children happens inside a transaction because I get an error when I do not enable…
Marc
  • 4,005
  • 3
  • 27
  • 44
3
votes
1 answer

Auto-cleared sessions with guice-persist

I'm using an environment with guice-servlet running on a tomcat and hibernate under guice-persist. The problem I've encountered is that when I use em.getReference() in one request the loaded proxy object stays in the entitymanager cache and may…
3
votes
1 answer

Hibernate/JPA not validating against DB schema on startup

For some reason hibernate is not catching issues like mapping entities to tables that do not exist. My persistence.xml file looks like this...
benstpierre
  • 30,487
  • 46
  • 163
  • 272
3
votes
3 answers

Guice JPA - "This connection has been closed." error

After DB dropps an idle connection or DB is down and back up I'm receiving the following error in my webapp: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: could not inspect JDBC autocommit mode at…
Jakub Bochenski
  • 2,687
  • 4
  • 29
  • 52
2
votes
4 answers

How do I use Guice Persist (Guice 3.0) with Wicket 1.5?

I want to find out how to use Guice Persist (Guice 3.0) with Wicket 1.5. I have not been able to find any 'hello world' type examples explaining how to do this, if you can link/provide such an example that would be great, and happily accepted as an…
Holm
  • 972
  • 2
  • 12
  • 20
2
votes
1 answer

How to inject/resolve properties into an XML file with Guice to configure the persistence.xml file?

I'm using guice-persist and I would like to know if there is any to inject or resolver properties from a Java property file into the persistence.xml file like I would do with Spring. For example:
GuidoMB
  • 2,001
  • 2
  • 24
  • 38
2
votes
1 answer

Does guice-persist support the @Finder annotation

Guice-persist was based on warp-persist which had the concept of finder methods. http://code.google.com/p/google-guice/wiki/GuicePersist was based on http://code.google.com/p/warp-persist/ I can see that there is an annotation for @Finder in…
benstpierre
  • 30,487
  • 46
  • 163
  • 272
2
votes
0 answers

How to get the EJBContext from Guice

I'm trying to create some integration tests for a j2ee application. The DAO layer requires a EJBContext so that it can call context.getUserTransaction() and utx.begin(). Using Guice i managed to get the EngityManager working. But the EJBContext is…
dinesh707
  • 10,694
  • 20
  • 74
  • 121
1
2 3 4