I still don't see a way to inject a datasource into the entitymanager. I'd like to keep the database connection information out of the persistence.xml.
On Sep 28, 3:13 pm, "Dhanji R. Prasanna" <[EMAIL PROTECTED]> wrote: > On Mon, Sep 29, 2008 at 8:04 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote: > > > I'm trying to convert my simple little test web app from using Spring > > 2.5 to using Google Guice. I've been reading a ton of documentation > > and examples, but I'm still having a couple of issues to work out > > before I change a line of code. I can't seem to find a good way to > > configure my datasource and entity manager using guice. Here is my > > current spring config: > > > <code> > > <bean id="entityManagerFactory" > > class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> > > <property name="dataSource" ref="dataSource" /> > > <property name="jpaVendorAdapter"> > > <bean > > class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> > > <property name="showSql" value="true" /> > > <property name="generateDdl" value="true" /> > > <property name="databasePlatform" > > value="org.hibernate.dialect.HSQLDialect" /> > > </bean> > > </property> > > </bean> > > <bean id="dataSource" > > class="org.springframework.jdbc.datasource.DriverManagerDataSource"> > > <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> > > <property name="url" value="jdbc:hsqldb:hsql://localhost:9001" /> > > <property name="username" value="sa" /> > > <property name="password" value="" /> > > </bean> > > </code> > > > I've seen warp-persist but I don't want to have to change my DAO's to > > use Provider<EntityManager> instead of just EntityManager. > > You don't have to with warp-persist--just make sure you don't bind your Daos > as @Singletons, then you can @Inject EntityManager directly. > > Dhanji. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" 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-guice?hl=en -~----------~----~----~----~------~----~------~--~---
