hibernate-4.x

Hibernate - Subclass has to be binded after it's mother class

自闭症网瘾萝莉.ら 提交于 2021-01-28 07:50:24
问题 after upgrading hibernate to from version 4.3.7.Final to 5.3.18.Final I got the error below @Entity @Audited @AuditPermission(Permission.VIEW_INDIVIDUAL) public class Individual implements ITemporalEntity { @Id @Column(name = "Individual_id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Individual_generator") @SequenceGenerator(name = "Individual_generator", initialValue = 1, allocationSize = 1, sequenceName = "Individual_id_seq") private Long id; @Embedded private

How do I disable SHOW WARNINGS from Hibernate?

廉价感情. 提交于 2020-01-03 17:00:52
问题 Using Hibernate (4.3.8) with MySQL, I noticed a bunch of SHOW WARNINGS statements taking considerable bandwidth in the activity log: I searched around and it's a pretty common issue (for example) that can apparently be resolved by increasing the log level to ERROR (and that solution is confirmed implemented since at least 4.3.6). The problem is, I don't actually know how to do this. My knowledge of Hibernate is about the bare minimum necessary to work with it. The previously linked post

Hibernate 4 Wildfly 8 logging not working

蓝咒 提交于 2020-01-03 16:12:21
问题 How do I get hibernate 4 to log via logback? I have a war deployed to wildfly 8 final, and I am using slf4j with logback. The logging setup is working 100% in the application with both the console appender and file appender working as intended. Here is what I did to get slf4j + logback working: Excluded the logging subsystem with jboss-deployment-structure.xml in WEB-INF: <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment> <exclude-subsystems> <subsystem name=

How can I globally set FlushMode for Hibernate 4.3.5.Final with Spring 4.0.6?

五迷三道 提交于 2020-01-02 05:22:05
问题 I'm trying to upgrade our application with Hibernate 4.3.5.Final and Spring 4.0.6. Any where in my app with database write operation gets an error as below: Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed

hibernate 4.3.x - load all entity annotated classes

空扰寡人 提交于 2019-12-30 18:37:42
问题 In a project which I work on I don't use Spring, I use Hibernate only. I don't want to use hbm.xml files for entity mappings/descriptions/etc. I want to use annotations only. How do I tell Hibernate to load all Entity/Table annotated classes from certain package(s)? I searched on the web but I have no luck. Also I don't find information about the latest Hibernate version (mostly outdated articles/posts/etc.). Edit 1: http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#mapping

NullPointerException from Spring's LocalSessionFactoryBuilder

牧云@^-^@ 提交于 2019-12-25 08:59:13
问题 I'll try to configure spring with hibernate using JTA and I have this spring xml file: model.xml <beans> <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManagerName" value="java:/TransactionManager" /> <property name="userTransactionName" value="UserTransaction" /> <property name="allowCustomIsolationLevels" value="true" /> </bean> <tx:annotation-driven transaction-manager="txManager" /> <jee:jndi-lookup id="dataSource" jndi

JPA query returns proxied entities

假如想象 提交于 2019-12-24 06:38:55
问题 Suppose I have 2 entities, EntityA and EntityB. EntityB is @OneToOne related to EntityA: @Entity public class EntityB { @OneToOne(fetch = FetchType.LAZY) private EntityA entA; // other stuff } When I load EntityB from DB, the corresponding EntityA (say entA1 ) is lazy loaded. After that I load EntityA list by List result = entityManager.createQuery("select A from EntityA A") .setFirstResult(start).setMaxResults(end).getResultList(); The result list contains both previously lazy loaded and

When/How do I set Ehcache used by Hibernate size programmatically

心不动则不痛 提交于 2019-12-23 09:34:49
问题 I have enabled 2nd level caching in Hibernate 4.3.11 by adding: config.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory"); config.setProperty("hibernate.cache.use_second_level_cache", "true"); to my Hibernate Config. This to my pom.xml (Not sure if necessary for pom definition to be this awkward) <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>4.3.11.Final</version> <exclusions>

java.lang.ClassNotFoundException: org.hibernate.engine.transaction.spi.TransactionContext

别说谁变了你拦得住时间么 提交于 2019-12-21 07:08:07
问题 I am developing Spring MVC Hibernate Integration example. In this example I'm using Spring 4.1.9.RELEASE and Hibernate 5.1.0.Final . If I downgrade Hibernate version to 4.3.5.Final then it works. Now inorder to use hibernate 5 what else configuration do I need to change. Please refer more details below. Please find below the exception I see java.lang.ClassNotFoundException: org.hibernate.engine.transaction.spi.TransactionContext at org.apache.catalina.loader.WebappClassLoaderBase.loadClass

Why doesn't openSession work but getCurrentSession works in Spring Hibernate

霸气de小男生 提交于 2019-12-20 09:46:01
问题 I have written a sample Spring Hibernate application o understand how Spring hibernate integration works. Here is my applicationContext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www