Hello Mike,
The default transaction configuration is REQUIRED for a session bean. So
each time you call your stateless method, a transaction is created and
committed (or rollbacked). So after the first call to 5 you should have
something in the database.
do you ?
Jean-Louis
mikeho wrote:
>
>
>
> Hi,
>
> Essentially what I am trying to is:
> 1) create a EntityManagerFactory outside of the container and use its em
> to persist some fixtures.
>
> final Properties p = new Properties();
> p.put("javax.persistence.jdbc.driver", "org.hsqldb.jdbcDriver");
> p.put("javax.persistence.jdbc.url", "jdbc:hsqldb:mem:hsqldb");
> p.put("eclipselink.target-database",
> "org.eclipse.persistence.platform.database.HSQLPlatform");
> p.put("javax.persistence.jdbc.user", "sa");
> p.put("javax.persistence.jdbc.password", "");
> p.put("eclipselink.ddl-generation", "drop-and-create-tables");
> p.put("eclipselink.ddl-generation.output-mode", "database");
> emf = Persistence.createEntityManagerFactory(
> this.persistenceUnitName, p);
>
> 2) I then create the InitialContext using the properties below:
>
> final Properties p = new Properties();
> p.put(Context.INITIAL_CONTEXT_FACTORY,
>
> p.put("jdbc/BrandGroupXADS", "new://Resource?type=DataSource");
> p.put("jdbc/BrandGroupXADS.JdbcDriver", "org.hsqldb.jdbcDriver");
> p.put("jdbc/BrandGroupXADS.JdbcUrl", "jdbc:hsqldb:mem:hsqldb");
> p.put("jdbc/BrandGroupXADS.eclipselink.jdbc.user", "sa");
> p.put("jdbc/BrandGroupXADS.eclipselink.jdbc.password", "");
> p.put("jdbc/BrandGroupXADS.eclipselink.target-database",
> "org.eclipse.persistence.platform.database.HSQLPlatform");
>
> 3) The persistence.xml looks like this (note no properties just the
> classes):
>
> <persistence-unit name="brandgroupPU" >
>
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> <jta-data-source>jdbc/BrandGroupXADS</jta-data-source>
>
> classes...
>
> </persistence-unit>
> </persistence>
>
> 4) I now do a jndi lookup for a staleless session bean and invoke a
> method to return the entity(s) persisted in step 1).
> It does this happily.
>
> 5) I then invove a method on the same SSB to insert another entity. CMP
> is used.
>
> 6) I repeat step 4) and the entity applied in step 5) does not appear
> in the result list.
>
> 7) I do have the following arg on my cammand
> line:-javaagent:{path}/openejb-javaagent-3.0.jar
>
>
> I've looked on the forum and tried various things. I'm beginning to think
> that I am overlooking something simple. Plse Help.
>
> Using:
> Apache OpenEJB 3.1.1 build: 20090530-06:18
> EclipseLink 2.0.0
> hsqldb 1.8.0
>
> Thnking you anticipation
>
> Regards
>
> Mike
>
--
View this message in context:
http://www.nabble.com/Embedded-OpenEJB-does-not-seem-to-be-flushing-to-the-DB-on-commit-tp25028791p25032699.html
Sent from the OpenEJB User mailing list archive at Nabble.com.