You need transaction active around the call to createNewUser().
If it's JTA then you need to add @Transactional on the method.  In
blueprint you can do this by doing something like:



    <bean id="userDao" class="org.example.UserDaoImp" activation="eager">
        <tx:transaction method="*" value="Required" />
        <jpa:context property="entityManager" unitname="your.p.unit.name" />
      </bean>


Please note:
        <tx:transaction method="*" value="Required" />


Good luck.




On Thu, Jul 10, 2014 at 12:00 PM, jimmy <[email protected]> wrote:

> I'm using openjpa, with a jta-data-source.
>
>
> public String createNewUser(){
>     Utilisateur uti = new Utilisateur();
>     uti.setUtiIdentifiant(UUID.randomUUID().toString());
>     uti.setUtiMotDePasse("xxxx");
>     em.persist(uti);
> }
>
> after a call to this method, the entity is not persisted in the database.
>
>
> public String createNewUser(){
>     Utilisateur uti = new Utilisateur();
>     uti.setUtiIdentifiant(UUID.randomUUID().toString());
>     uti.setUtiMotDePasse("xxxx");
>     em.persist(uti);
> *    em.flush() ---> really persist*
> }
>
> Why the entity manager does'nt flush automatically at end of java
> transaction ?
> (there is no property to flush at commit in openjpa).
>
> Has someone this problem with JTA - OPENJPA ?
>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/JPA-JTA-tp4034133.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Reply via email to