Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate auto-generated code reporting successful persist but no new records in DB found
    primarykey
    data
    text
    <p>I have some auto-generated hibernate DAO code which was generated by Eclipse-hibernate reverse engineering plugin.</p> <p>The EntityManager object's 'persist' method is not throwing any exception but the object is not persisted to the database. Currently the database is table is empty (no records).</p> <p>I get the following output, any ideas?</p> <pre><code>Starting test 'createNewAccountTest' Feb 20, 2012 5:25:47 PM org.hibernate.annotations.common.Version &lt;clinit&gt; INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} Feb 20, 2012 5:25:47 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.0.1.Final} Feb 20, 2012 5:25:47 PM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost/ptbrowserdb, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=com.mysql.jdbc.Driver} Feb 20, 2012 5:25:47 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Feb 20, 2012 5:25:48 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) Feb 20, 2012 5:25:48 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 Feb 20, 2012 5:25:48 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: true Feb 20, 2012 5:25:48 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/ptbrowserdb] Feb 20, 2012 5:25:48 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {user=root, password=****, autocommit=true, release_mode=auto} Feb 20, 2012 5:25:48 PM org.hibernate.dialect.Dialect &lt;init&gt; INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect Feb 20, 2012 5:25:48 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 Feb 20, 2012 5:25:48 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory Feb 20, 2012 5:25:48 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory &lt;init&gt; INFO: HHH000397: Using ASTQueryTranslatorFactory persist successful </code></pre> <p>As well, here is a code snip, I am manually creating a 'Pokemons' object and passing it into the 'persist(..)' method here.</p> <pre><code>@PersistenceContext private EntityManager entityManager; private void initManager() { if(entityManager != null) return; EntityManagerFactory factory; factory = Persistence.createEntityManagerFactory("manager1"); entityManager = factory.createEntityManager(); } public void persist(Pokemons transientInstance) { if(entityManager == null) initManager(); log.debug("persisting Pokemons instance"); try { entityManager.persist(transientInstance); System.out.println("persist successful"); log.debug("persist successful"); } catch (RuntimeException re) { log.error("persist failed", re); throw re; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload