hibernate-entitymanager

JPA+ORACLE: Can't pass boolean param to my stored procedure

旧时模样 提交于 2021-02-10 05:42:05
问题 I can not pass boolean param to my stored procedure in Oracle. If I set value directly in the query text (mypackage.Test(?, false, ?, ?);) all work fine... jdbc-driver: ojdbc6.jar container: Tomcat 7.0.28 hibernate-core+hibernate-entitymanager: 4.1.6.Final oracle: Oracle Database 11g Release 11.2.0.2.0 - 64bit Production Here my realization: EntityManager em = defaultFactory.createEntityManager(); em.createNativeQuery("BEGIN mypackage.Test(?, ?, ?, ?); END;")// .setParameter(1, factId)//

JPA - createEntityManagerFactory returns Null

只谈情不闲聊 提交于 2021-01-27 07:56:59
问题 Noob question here. I'm following this example/tutorial to try and isolate a problem I keep getting on my main project. Problem is, the entityManagerFactory keeps returning null (thus, I get a NullPointerExcept when trying to run the first JUnit test.) I'm currently on Eclipse Indigo (JavaEE) - JRE7 - Hibernate 3.6.7 and JBoss 7 And here's my persistence.xml (again, a copipasta taken right from the tutorial) <persistence> <persistence-unit name="examplePersistenceUnit" transaction-type=

JPA - createEntityManagerFactory returns Null

允我心安 提交于 2021-01-27 07:56:18
问题 Noob question here. I'm following this example/tutorial to try and isolate a problem I keep getting on my main project. Problem is, the entityManagerFactory keeps returning null (thus, I get a NullPointerExcept when trying to run the first JUnit test.) I'm currently on Eclipse Indigo (JavaEE) - JRE7 - Hibernate 3.6.7 and JBoss 7 And here's my persistence.xml (again, a copipasta taken right from the tutorial) <persistence> <persistence-unit name="examplePersistenceUnit" transaction-type=

How to change Hibernate GenerationType identifier depending on the underlying database

人走茶凉 提交于 2020-01-04 15:16:21
问题 I have a project called main_project (uses spring-boot v2) that contains all configuration classes including JPA configuration . The main_project also has entity classes (Like User, Personnel). The JPA configuration for managed entity class in main_project is like below: @Entity public abstract class MainEntity<T extends Serializable> { @Id @GeneratedValue(GenerationType=?) @Column(name = "id") private T id; } @Entity public class Personnel extends MainEntity<Long> { @Column(name = "firstName

Hibernate Search integrated into Play Framework (JPA)

╄→гoц情女王★ 提交于 2019-12-25 07:58:40
问题 Im am trying to use Hibernate Search together with Play Framework. It seams very easy and straight forward. But I get a exception (see below): Here is what I did: I added dependencies "org.hibernate" % "hibernate-entitymanager" % "4.3.8.Final", "org.hibernate" % "hibernate-search-orm" % "5.2.0.Final", I already had Entitymanager and it works fine. Then I added the Hibernate Search properties: http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name=

Caused by: java.lang.IllegalStateException: EntityManagerFactory must not be null

时光怂恿深爱的人放手 提交于 2019-12-24 18:13:30
问题 I previously was using Spring Boot 1.4.2.RELEASE and Hibernate 5.0.11.Final , and this was my Database configuration class: @Configuration @EnableTransactionManagement public class DataBaseConfiguration { @Bean(name = "sessionFactory") public HibernateJpaSessionFactoryBean sessionFactory() { return new HibernateJpaSessionFactoryBean(); } @Bean public HibernateTransactionManager transactionManager() { HibernateTransactionManager transactionManager = new HibernateTransactionManager();

How to use JOIN using Hibernate's session.createSQLQuery()

浪尽此生 提交于 2019-12-24 09:38:17
问题 I have two Entity (tables) - Employee & Project. An Employee can have multiple Projects. Project table's CREATOR_ID field refers to Employee table's ID field. Employee entity does not maintain any reference for Project - but Project entity has a reference for Employee. Using EntityManager following query works fine - entityManager.createQuery( "select e from EmployeeDTO e, ProjectDTO p" + " where p.id = ?1 and p.creator.id=e.id"); But since I have the LAZY association relationship, I get

Hibernate Entity manager auto flush before query and commit changes to DB in transaction

淺唱寂寞╮ 提交于 2019-12-23 18:21:06
问题 I am using Hibernate 3.6.0 with JPA 2 on Jboss AS 6.0.0 final. In an EJB of mine, there's a method which updated entity values and do some query on it. The whole method is running in a BMT transaction. If anything fails, all changes should be rollback and not committed to DB. The Database is mySql. Before running JPA query, JPA will auto flush the changed states to DB to prevent any stale data from returning. However, within my method, the auto-flush directly update and commits the changes to

JPA with Hibernate 5: programmatically create EntityManagerFactory

我只是一个虾纸丫 提交于 2019-12-22 04:12:22
问题 This question is specifically about programmatically creating a JPA EntityManagerFactory backed by Hibernate 5, meaning without configuration xml files and without using Spring . Also, this question is specifically about creating an EntityManagerFactory with a Hibernate Interceptor . I know how to create a Hibernate SessionFactory the way I want, but I do not want a Hibernate SessionFactory , I want a JPA EntityManagerFactory backed by a Hibernate SessionFactory . Given an

Hibernate: Unable to access TransactionManager or UserTransaction to make physical transaction delegate

丶灬走出姿态 提交于 2019-12-18 15:55:32
问题 I was using Servlets, PostgreSQL and Hibernate with EntityManager to build a Web app and everything was working ok until I moved the project to a Maven based project. Now I'm getting this weird exception every time I try to create an EntityManager from an EntityManagerFactory : org.hibernate.resource.transaction.backend.jta.internal.JtaPlatformInaccessibleException: Unable to access TransactionManager or UserTransaction to make physical transaction delegate at org.hibernate.resource