Data is not getting inserted into the Database

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Data is not getting inserted into the Database

suchi

Hello All,

 

I'm using the following configurations: 
1. PostgreSQL (9.3-1101.jdbc4) 
2. Hibernate (4.3.5.Final) 
3. JPA (hibernate-jpa-2.1-api) 
4. BitronixTransactionManager (org.hibernate.service.jta.platform.internal.BitronixJtaPlatform) 

Note: Not using Spring 

Note: I'm first beginning the transaction and then creating entity manager to persist the entity. 

However, upon committing the transaction, I see the INSERT QUERY begin executed , but the data is never inserted into the database.   
Can someone please let me know your feedback on how to resolve this issue?

The console logs looks like the below code: 
 [main] INFO bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/test] 
 [main] INFO com.xxx.SampleTest  - Creating the transient patient entity with new, not yet persisted or used 
 [main] INFO com.user.RandomGUID  - Initializing ... 
... 
 [main] INFO com.xxx.SampleTest  - setting up the transactions for persisting, should have persisted into the database 
 [main] INFO com.xxx.PersistenceManagerSession  - PersistenceManagerSession Loading Bitronix Transaction Manager 
Hibernate: 
    select 
        nextval ('user.user_ID_seq') 
Hibernate: 
    insert 
    into 
        user.USER 
        ( NAME, USER_ID) 
    values 
        (?, ?) 
[main] WARN bitronix.tm.twopc.Preparer  - executing transaction with 0 enlisted resource 

 

 

Thanks,

Suchi

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data is not getting inserted into the Database

Ludovic Orban-2
Theer definitely is something wrong with your setup, or with the way
you use the entity manager / tx manager / connection pool. The
"executing transaction with 0 enlisted resource" warning is a good
hint that the JTA transaction was committed while the database work
happened outside of its control, hence there was nothing to commit.
The first thing I would look at is that there is a <jta-data-source>
element in your PU XML config.

Have a look at this blog, it documents quite well how to quickly get
started with BTM and Hibernate:
http://blog.christianbauer.name/Hibernate%20with%20Bitronix%20JTA%20connection%20pool/

On Wed, Apr 29, 2015 at 11:50 PM, suchi <[hidden email]> wrote:

> Hello All,
>
> I'm using the following configurations:
> 1. PostgreSQL (9.3-1101.jdbc4)
> 2. Hibernate (4.3.5.Final)
> 3. JPA (hibernate-jpa-2.1-api)
> 4. BitronixTransactionManager (org.hibernate.service.jta.platform.internal.BitronixJtaPlatform)
>
> Note: Not using Spring
>
> Note: I'm first beginning the transaction and then creating entity manager to persist the entity.
>
> However, upon committing the transaction, I see the INSERT QUERY begin executed , but the data is never inserted into the database.
> Can someone please let me know your feedback on how to resolve this issue?
>
> The console logs looks like the below code:
>  [main] INFO bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/test]
>  [main] INFO com.xxx.SampleTest  - Creating the transient patient entity with new, not yet persisted or used
>  [main] INFO com.user.RandomGUID  - Initializing ...
> ...
>  [main] INFO com.xxx.SampleTest  - setting up the transactions for persisting, should have persisted into the database
>  [main] INFO com.xxx.PersistenceManagerSession  - PersistenceManagerSession Loading Bitronix Transaction Manager
> Hibernate:
>     select
>         nextval ('user.user_ID_seq')
> Hibernate:
>     insert
>     into
>         user.USER
>         ( NAME, USER_ID)
>     values
>         (?, ?)
> [main] WARN bitronix.tm.twopc.Preparer  - executing transaction with 0 enlisted resource
>
>
> Thanks,
> Suchi
>
>
>
>
> --
> View this message in context: http://bitronix-transaction-manager.10986.n7.nabble.com/Data-is-not-getting-inserted-into-the-Database-tp1716.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Data is not getting inserted into the Database

suchi

Thanks you so much for your response Ludovic. http://n7.nabble.com/images/smiley/smiley_beam.gif

I do have the following lines in my persistence.xml:
  <persistence-unit name="myPU" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <jta-data-source>jdbc/test</jta-data-source>


However, I noticed upon debugging that while trying to commit() the transaction (currentTx.commit();)
The currentTx's -> preparer object has no resources.  (preparedResources is [])

I believe it should hold the datasaource and is the reason behind I getting "executing transaction with 0 enlisted resource ".

How do you suggest should I go about it.

Thanks a lot,
Suchi

 

From: Ludovic Orban-2 [via Bitronix Transaction Manager] [mailto:ml-node+[hidden email]]
Sent: Thursday, April 30, 2015 12:53 AM
To: Subudhi, Suchi
Subject: Re: Data is not getting inserted into the Database

 

Theer definitely is something wrong with your setup, or with the way
you use the entity manager / tx manager / connection pool. The
"executing transaction with 0 enlisted resource" warning is a good
hint that the JTA transaction was committed while the database work
happened outside of its control, hence there was nothing to commit.
The first thing I would look at is that there is a <jta-data-source>
element in your PU XML config.

Have a look at this blog, it documents quite well how to quickly get
started with BTM and Hibernate:
http://blog.christianbauer.name/Hibernate%20with%20Bitronix%20JTA%20connection%20pool/

On Wed, Apr 29, 2015 at 11:50 PM, suchi <[hidden email]> wrote:


> Hello All,
>
> I'm using the following configurations:
> 1. PostgreSQL (9.3-1101.jdbc4)
> 2. Hibernate (4.3.5.Final)
> 3. JPA (hibernate-jpa-2.1-api)
> 4. BitronixTransactionManager (org.hibernate.service.jta.platform.internal.BitronixJtaPlatform)
>
> Note: Not using Spring
>
> Note: I'm first beginning the transaction and then creating entity manager to persist the entity.
>
> However, upon committing the transaction, I see the INSERT QUERY begin executed , but the data is never inserted into the database.
> Can someone please let me know your feedback on how to resolve this issue?
>
> The console logs looks like the below code:
>  [main] INFO bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/test]
>  [main] INFO com.xxx.SampleTest  - Creating the transient patient entity with new, not yet persisted or used
>  [main] INFO com.user.RandomGUID  - Initializing ...
> ...
>  [main] INFO com.xxx.SampleTest  - setting up the transactions for persisting, should have persisted into the database
>  [main] INFO com.xxx.PersistenceManagerSession  - PersistenceManagerSession Loading Bitronix Transaction Manager
> Hibernate:
>     select
>         nextval ('user.user_ID_seq')
> Hibernate:
>     insert
>     into
>         user.USER
>         ( NAME, USER_ID)
>     values
>         (?, ?)
> [main] WARN bitronix.tm.twopc.Preparer  - executing transaction with 0 enlisted resource
>
>
> Thanks,
> Suchi
>
>
>
>
> --
> View this message in context: http://bitronix-transaction-manager.10986.n7.nabble.com/Data-is-not-getting-inserted-into-the-Database-tp1716.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




If you reply to this email, your message will be added to the discussion below:

http://bitronix-transaction-manager.10986.n7.nabble.com/Data-is-not-getting-inserted-into-the-Database-tp1716p1717.html

To unsubscribe from Data is not getting inserted into the Database, click here.
NAML

Loading...