tagged [hibernate]

How to delete multiple db entities with Nhibernate?

How to delete multiple db entities with Nhibernate? What is the best practice for this problem? Is there any batching features built-in? Sample code: Thanks in advance.

C# put pc to sleep or hibernate

C# put pc to sleep or hibernate I want to put my system to either sleep or hibernate, two different options. How would I do this with API's, I don't really want to use Process, and that doesn't allow ...

24 Nov at 15:13

Getting Database connection in pure JPA setup

Getting Database connection in pure JPA setup We have a JPA application (using hibernate) and we need to pass a call to a legacy reporting tool that needs a JDBC database connection as a parameter. Is...

16 Aug at 20:51

Hibernate: How to fix "identifier of an instance altered from X to Y"?

Hibernate: How to fix "identifier of an instance altered from X to Y"? in fact, my `user` table is really must dynamically change its value, my Java app is multithreaded. Any ideas how to fix it?

15 Jan at 20:27

How do you create a Distinct query in HQL

How do you create a Distinct query in HQL Is there a way to create a Distinct query in HQL. Either by using the "distinct" keyword or some other method. I am not sure if distinct is a valid keywork fo...

4 Nov at 23:17

Found shared references to a collection org.hibernate.HibernateException

Found shared references to a collection org.hibernate.HibernateException I got this error message: > error: Found shared references to a collection: Person.relatedPersons When I tried to execute `addT...

Create session factory in Hibernate 4

Create session factory in Hibernate 4 I'm having trouble generating a session factory in Hibernate 4. In Hibernate 3 I simple did: Now I need to pass a ServiceRegistry class to buildSessionFa

4 Nov at 10:20

Native query with named parameter fails with "Not all named parameters have been set"

Native query with named parameter fails with "Not all named parameters have been set" I want to execute a simple native query, but it does not work: Why am I getting this exception? ``` org.hibe

27 Nov at 13:45

how to configure hibernate config file for sql server

how to configure hibernate config file for sql server Here is the config file for MySQL: ``` org.gjt.mm.mysql.Driver jdbc:mysql://localhost/test root

JPA/Hibernate support for migration?

JPA/Hibernate support for migration? I'm currently working on a desktop application using JPA/Hibernate to persist data in a H2 database. I'm curious what my options are if I need to make changes to t...

7 Mar at 17:47

Hibernate: flush() and commit()

Hibernate: flush() and commit() Is it good practice to call `org.hibernate.Session.flush()` separately? As said in `org.hibernate.Session` docs, > Must be called at the end of a unit of work, before c...

3 Oct at 11:22

What is the difference between JOIN and JOIN FETCH when using JPA and Hibernate

What is the difference between JOIN and JOIN FETCH when using JPA and Hibernate Please help me understand where to use a regular JOIN and where a JOIN FETCH. For example, if we have these two queries ...

7 Feb at 09:2

How do you do a limit query in JPQL or HQL?

How do you do a limit query in JPQL or HQL? In Hibernate 3, is there a way to do the equivalent of the following MySQL limit in HQL? I don't want to use setMaxResults if possible. This definitely was ...

24 Mar at 13:35

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do I really want to know more about the update, export and the values that could be given to `hibernate.hbm2dd...

15 Apr at 15:24

How can I know when Windows is going into/out of sleep or Hibernate mode?

How can I know when Windows is going into/out of sleep or Hibernate mode? Is it possible to subscribe to a Windows event that fires when Windows is going into or coming out of Sleep or Hibernate state...

2 Dec at 11:50

Hibernate show real SQL

Hibernate show real SQL if I set in my configuration file in the console I can see the SQL. But it's not SQL... Can I see the SQL code that will be passed directly to database? Example: I see Can I se...

4 Mar at 22:8

How do you add PostgreSQL Driver as a dependency in Maven?

How do you add PostgreSQL Driver as a dependency in Maven? I'm trying to develop a Java application with Maven while using Hibernate with a PostgreSQL database for persistence. I don't understand how ...

30 Jan at 20:8

How to resolve this Exception : Data source rejected establishment of connection, message from server: "Too many connections"

How to resolve this Exception : Data source rejected establishment of connection, message from server: "Too many connections" I am using Hibernate 3 +Mysql 5.1 and after 98 insertion i am getting this...

2 Jun at 13:28

Name attribute in @Entity and @Table

Name attribute in @Entity and @Table I have a doubt, because name attribute is there in both @Entity and @Table For example, I'm allowed to have same value for name attribute and I can have different ...

Disabling contextual LOB creation as createClob() method threw error

Disabling contextual LOB creation as createClob() method threw error I am using Hibernate 3.5.6 with Oracle 10g. I am seeing the below exception during initialization but the application itself is wor...

27 Aug at 11:26

Cross field validation with Hibernate Validator (JSR 303)

Cross field validation with Hibernate Validator (JSR 303) Is there an implementation of (or third-party implementation for) cross field validation in Hibernate Validator 4.x? If not, what is the clean...

How does JPA orphanRemoval=true differ from the ON DELETE CASCADE DML clause

How does JPA orphanRemoval=true differ from the ON DELETE CASCADE DML clause I am a little confused about the JPA 2.0 `orphanRemoval` attribute. I think I can see it is needed when I use my JPA provid...

What is the use of the @Temporal annotation in Hibernate?

What is the use of the @Temporal annotation in Hibernate? The Hibernate Documentation has the information below for the `@Temporal` annotation: > In plain Java APIs, the temporal precision of time is ...

31 Aug at 15:18

Hibernate SessionFactoryBean for multiple locations of mapping files

Hibernate SessionFactoryBean for multiple locations of mapping files We have a project consisting of multiple subprojects. With each subproject we potentially have some hibernate mapping files but in ...

1 Oct at 12:11

Hibernate Hql find result size for paginator

Hibernate Hql find result size for paginator I need to add paginator for my Hibernate application. I applied it to some of my database operations which I perform using Criteria by setting Projection.c...

9 May at 13:55