Questions tagged [hibernate-4.x]

Represents the 4.x release of the Hibernate Object/Relational Mapping project

302 questions
11
votes
4 answers

Spring: Why the SessionFactoryUtils class in Hibernate 4 does not provide the getSession method?

What happened to the SessionFactoryUtils.getSession method from Hibernate 4 in Spring 3.1.0 ? What should be used instead ? sessionFactory.getCurrentSession() keeps giving me this exception: org.hibernate.HibernateException: No Session found for…
gastaldi
  • 728
  • 1
  • 6
  • 17
11
votes
3 answers

java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration

i have created a maven project and added Spring4, Hibernate4 libs through pom.xml I m trying to link my web app with my database created in PostgreSql, but when i publish my project in apache tomcat 7 the following exception occurs :…
11
votes
1 answer

Generate schema in dropwizard-hibernate

I followed the tutorial for dropwizard and hibernate without problems. Now I have non trivial annotations in my entities, and I would like hibernate to generate the tables for me, and stuff like that.So, how can I change hibernate's configuration?…
dgn
  • 1,213
  • 2
  • 13
  • 20
10
votes
1 answer

Generate DDL script at MAVEN build with Hibernate4 / JPA 2.1

It seems like the hibernate3-maven-plugin used to generate DDL create/drop scripts is not compatible any more with Hibernate 4.3 and newer versions (using JPA 2.1). I use this plugin configuration :
Donatello
  • 3,486
  • 3
  • 32
  • 38
9
votes
3 answers

Exception in GWT Dev Mode + Spring 3.1 + Hibernate 4.0.1

I have a GWT+Hibernate+JPA+Spring configuration file which is OK with Spring 3.0.x + Hibernate 3.6.x. When I upgraded to Spring 3.1 and Hibernate 4.0, the following exception is thrown: Is there any known incompatibility withe Hibernate 4 and Spring…
Mohsen
  • 3,512
  • 3
  • 38
  • 66
9
votes
1 answer

Get a list of managed Entity instances in a persistence context

Is there a way to obtain a list of "known" Entity instances for a given Session/EntityManager in JPA/Hibernate 4.x? By "known" I mean either loaded, created or changed, i.e. a managed entity that exists in a persistence context. I know of…
Boris B.
  • 4,933
  • 1
  • 28
  • 59
8
votes
2 answers

Hibernate spatial functions keep throwing unexpected AST node

I'm trying to query spatial relations between my entities but keep getting this exception: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: ( near line 1, My entities are working properly, so is the mapping. I believe that…
Moa
  • 441
  • 4
  • 13
8
votes
3 answers

How to create a generic entity model class that supports generic id including auto generated ids?

I have three kinds of primary keys for tables: INT auto generated primary key which use AUTO_INCREMENT capacity from database vendor (MySQL) CHAR(X) primary key to store a user readable value as key (where X is a number and 50 <= X <= 60) Complex…
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
8
votes
2 answers

Hibernate 4 explicit polymorphism (annotation) not working?

I am facing problem with hibernate's explicit polymorphism. I used the polymorphism annotation and set it to explicit, but with get() and collections in mapped classes i always get all subclasses. I see all subclasses with left join in the hibernate…
Floaz
  • 140
  • 1
  • 5
7
votes
1 answer

Why does Hibernate 2nd level statics show different values then CacheManager

Using Hibernate 4.3.11 and Ehcache 2.7.0 Why does the hits/Misses returned by Hibernates getStatistics() not matched values returned by CacheManager. I have enabled 2nd level caching for a single class. So with this code Statistics stats =…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
7
votes
1 answer

hibernate 4.3.x - load all entity annotated classes

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…
peter.petrov
  • 38,363
  • 16
  • 94
  • 159
7
votes
1 answer

Hibernate 4 Annotation Configuration

I'm trying to use Hibernate 4 with annotations only, and a hibernate.cfg.xml file. I've made my own annotation and am using reflection to add this to the configuration. I'm able to use Hibernate 4 in this manner fine, but my configuration is being…
6
votes
2 answers

New XSD schema in Hibernate 4

In Hibernate 4 I've found (new for me) possibility to use XSD schema instead of DTD.
smg
  • 173
  • 1
  • 8
6
votes
1 answer

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

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",…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
6
votes
4 answers

hibernate second level cache is slow

I am using hibernate second-level caching with in-memory ehcache, and it is slow. I mean, not slower than SQL, but not really faster either given a fast database on an SSD. The actual speed increase is less than a factor of 2, and sometimes…
P.Péter
  • 1,527
  • 16
  • 39
1
2
3
20 21