Questions for hibernate


Hibernate Entity not being persisted

I am building a web app built on Spring MVC and Hibernate. I have an existing domain model and the application is largely working.

Persisting Users using Hibernate

I've created a UserObject and RoleObject to represent users in my application. I'm trying to use hibernate for CRUD instead of raw JDBC. I've successfully retrieved the information from the data...

LazyInitializationException (Spring and Vaadin) despite of OpenEntityManagerInView

I am using Spring Roo and Vaadin for a (simple) database application. There is a view displaying a Table containing entities. For the table to be displayed, Hibernate needs to lazily load 1:n refer...

How do I change my XML to have hibernate to define the DataSource

can someone please show me how to change my XML to have hibernate to define the DataSource. I would like to see a good sample of it. Below is my xml file. can someone post what it would look like...

Hibernate Annotation Placement Question

I've got what I think is a simple question. I've seen examples both ways. The question is - "why can't I place my annotations on the field?". Let me give you an example....

GWT Cannot Serialize My Object from Hibernate

Here is the error I am receiving. I've looked everywhere for answers and I cannot figure out why anyone else isn't running into the same issue. The error happens when I'm retrieving a Proposal object

Using enum vs Boolean?

This may initially seem generic, but in fact, I am actually making the decision on which I need to use.

Getting error during SessionFactory creation

I keep getting when I want to run my hibernate code. I'm using Spring 3 MVC and Spring 3 security in my app.

Hibernate/GORM - Handling multi-session domain object updating

I'm curious about best practice when it comes to updating a domain object that may be updated by multiple sessions.

Hibernate: mapping many-to-many to Map

I am developing an application which deals with two following entities: Products (let's name it as X, Y, Z) and Materials (a, b, c, ...). It's known that every product has a recipe which indicates ...

Hibernate Bidirectional Many to Many implementation

I am new to hibernate and I want to implement something like this in hibernate. To be able to do this, I am getting problem in setting the xml mapping file. If someone can help me, it would be very...

SQl Query to Hibernate Query

I have a MYSQL query that I use to retrieve random rows from a table. The query is :

How to use regular expressions with Hibernate/Oracle

I'm trying to implement a web service which accepts a list of strings, each of which is a regular expression. These need to be compared against six columns of a database, and any rows which match ...

Hibernate Error in GWT

I am getting a hibernate error. I am just doing a proof of concept to test for association in hibernate. I am almost sure that the error i think lies in the mapping file but i cannot figure it

Conditional/composite JoinColumn In JPA/Hibernate

In one of my classes, say Location, I have something like this:

specify db password in ant build file

my webapp has a hibernate config file that specifies db password as follows:

Hibernate mapping error - Unknown entity

I'm a hibernate newbie and im receiving this error when trying to persist an object -
1265 Premature EOF in REST in java using jersey

I implement a RESTful Web Service in Java using jersey and run it on Tomcat7.

Optimizing data inserts for HibernateTemplate

I have to optimize the database (especially insert) performance of a certain legacy tool. The tool has been written in Java and for the data access layer Spring + HibernateTemplate was the technolo...

java.lang.NullPointerException at org.hibernate.hql.ast.HqlParser.negateNode

I'm currently working on a Java EE project which uses JPA. I'm connecting to a InnuDB MySQL DB and after having some problems with some entities relations (ManyToMany) I changed some of the Collec...

Hibernate, return custom object with Criteria or HQL

there is a way to return a custom object with a criteria query or hql query?

JPA Multiple Entity with Collection Query

I have the following in SQL:

Mapping a set in Hibernate with a composite primary key

For reasons related to DB replication, I need all the tables in my DB to have primary keys.

Using Hibernate to migrate data

Developing a brand new schema/app which uses hibernate to create tables from pojo's.

Spring MVC-Hibernate error: BasicDataSource is not found

I created a spring mvc project using Spring Roo, with MySql database and Hibernate provider. The problem is that when I run it I get the following error:

LONG as primary key in Hibernate mapping to MySQL

I am trying to implement persistence of some Java objects via Hibernate mapping to a MySQL table. When I commit I get a message saying 'Batch update returned unexpected row count from update [0]; a...

Grails sequence generation for Oracle 11g

I realize this is more of a hibernate question than Grails. In a load balanced (2 nodes) environment I see that the ids of my objects are jumping around quite a bit. Even without restarting the app

Spring + Hibernate confuguration

I am trying to integrate Spring and Hibernate but when I run the code and submit my for then it throws this exception

Is it not a good practice to have logic in dao side?

I have entity A and A has set of entity B. I do lazy loading. When I load all of the A results list I need to have a transient value for each A that has the size of B for that A.

JPA2 (Hibernate) how to query 2 tables (joined) but only need certains properties from 2nd table

I am using JPA2 with hibernate as provider in java ee6 environment.

JProfiler shows “unknown” JDBC calls take 40% of the time

I am using JProfiler to view all the JDBC calls in my application that's using Hibernate. It turns out that the top 2 hot spots are "unknown" and "select 1". Any ideas what they are?

HibernateTransactionManager or JpaTransactionManager

Developing application with friend, but ran into a question...

Errors while iterate over a List of objects in hibernate +Java?

I need to iterate and manipulate the list with my corresponding getters and setters. I tried the following based on the forum answer Retrieving Hibernate query result as result set instead of list

Hibernate and MySQL, Importing stored procedure

What's the proper way of importing/declaring stored procedure in Hibernate.

EmbeddedId, sequence and ConstraintViolationException

I've got entity, which has @EmbeddedId. In the id class there are a few fields, and one of them is Long id with Generation type sequence. Problem apperas when I'm trying to insert instance of this

JPA 2.0 orphanRemoval=true VS on delete Cascade

I am a little confused about the JPA 2.0 orphanRemoval attribute.

grails / GORM / hibernate - hasMany map not synchronised on save() of parent

Problem deleting associated entities and having this change persisted to the database.

Hibernate Not Loading Postgresql bytea consistently

I am using Hibernate 3.6 on two different boxes, both reading from exactly the same database table. The Hibernate annotation for two fields is as such:

Hibernate: Parse/Translate HQL FROM part to get pairs class alias, class name

Can anyone point me out, how can I parse/evaluate HQL and get map where key is table alias and value - full qualified class name.

Configure pom.xml for hibernate 3.6

I tried to conigure pom.xml file for my Spring 3 & Hibernate 3.6 application.

Front end technology / framework

I am using Spring MVC and Hibernate for a project. I am little confused about which technology to use in front end part(in jsp part), to get better look and fill as well which is easy to adopt.

Get Dialect within some class inside Spring MVC + Hibernate application

I have Hibernate Transaction manager configured inside Spring MVC controller.

How to update Hibernate delivered with Play?

Play frameworks comes with an old Hibernate version (3.6.1). How can I update Hibernate in my Play application? Via Ivy?

Need an example of a primary-key @OneToOne mapping in Hibernate

Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :

Prepared statements, hibernate and HQL

Hibernate internally uses PreparedStatements under JDBC when converting HQL to SQL. How are inline parameters within an HQL handled ?

Is there a Java user management package similar to Django auth application?

I'm looking for a java package/spring user management package that is similar to django's auth application, which provides the database models such as User and Group out-of-the-box.

“Session closed” error when trying to get a blob from DB using getBinaryStream()

I'm using Hibernate 3.1 and Oracle 10 DB. The blob is defined as @Lob @Basic @Column in the Hibernate entity which corresponds to the relevant DB table.

Can an entity have more than one many-to-many relations?

I have a table that has two different many-to-many relations to two different tables. Let's say I have User <---> UserRole <--> Role and User <--> UserGroups <--> Groups. Since I am new...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.