Note that there are some explanatory texts on larger screens.

plurals
  1. POjava - Insert fail when using Spring, hibernate and JPA with JBOSS 7.1 server
    primarykey
    data
    text
    <p>I'm trying to set up the hibernate + JPA on my project. but when I try to do an insert nothing happens, I go into the source code of hibernate jars and I see that hibernate it's recognizing my entity as TRANSIENT state and not as PERSISTENT.</p> <p>Some of my configuration is:</p> <p>My Spring context:</p> <pre><code> &lt;jee:jndi-lookup id="integrationDS" jndi-name="java:jboss/datasources/integrationDS" expected-type="javax.sql.DataSource"/&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="integrationDS" /&gt; &lt;/bean&gt; </code></pre> <p>My persistence xml:</p> <pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"&gt; &lt;persistence-unit name="integrationDS"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;jta-data-source&gt;java:jboss/datasources/integrationDS&lt;/jta-data-source&gt; &lt;class&gt;com.integration.domain&lt;/class&gt; &lt;class&gt;com.integration.domain.myentity&lt;/class&gt; &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt; &lt;validation-mode&gt;NONE&lt;/validation-mode&gt; &lt;properties&gt; &lt;property name="javax.persistence.validation.mode" value="none" /&gt; &lt;property name="hibernate.validator.autoregister_listeners" value="false" /&gt; &lt;property name="hibernate.generate_statistics" value="true" /&gt; &lt;property name="hibernate.jdbc.batch_size" value="100"/&gt; &lt;property name="hibernate.validator.apply_to_ddl" value="false" /&gt; &lt;property name="hibernate.dialect" value="com.integration.util.MysqlBitBooleanDialect" /&gt; &lt;property name="hibernate.id.new_generator_mappings" value="false" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt; &lt;property name="hibernate.cache.use_second_level_cache" value="false" /&gt; &lt;property name="hibernate.cache.use_query_cache" value="false" /&gt; &lt;property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" /&gt; &lt;property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; </code></pre> <p></p> <p>My code:</p> <pre><code> @Transactional public &lt;T&gt; T executeSaveInTransaction(T entity) { try { getDao().persist(entity); return entity; } catch (RuntimeException e) { //rollbackTransaction(); throw e; } catch (Exception e) { //rollbackTransaction(); throw new DaoException(e); } finally { // clear resources } } </code></pre> <p>any idea?</p> <p>Thanks,</p>
    singulars
    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.
 

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