0
votes
2answers
19 views

Select entity from two tables in hibernate

I have two tables like this: +------------+ +------------+ | Parent | | Child | +------------+ +------------+ |child_id |------------>|id ...
-2
votes
0answers
12 views

How the solve this issue? am getting the error while sending an automatic email when user is registered

How to resolve this issue. am getting the below error when am sending the mail when user is registered Sorry, the email was not sent because of the following error: Authentication failed; nested ...
1
vote
0answers
13 views

Incorrect string value as I try to store a file as longblob into a mysql database

I have a simple web application to upload files and store them in a longblob into a mysql database. But I get the following exception: Caused by: java.sql.SQLException: Incorrect string value: ...
0
votes
0answers
9 views

Custom @Unique validator in Spring throws Hibernate Assertion failure

I made a custom @UniqueNombre validator to check if an user name already exists in the database and, when it is not repeated and tries to persist the data it throws an Hibernate exception: ERROR ...
0
votes
1answer
19 views

Detached entity passed to persist

CacheId aci = new CacheId(); aci.setId(cacheObject.getId()); aci.setSequence(cacheObject.getSequence()); Cache persisted = em.find(Cache.class, aci); if (persisted == null){ ...
-9
votes
2answers
32 views

java.lang.ClassCastException: java.lang.Integer cannot be cast to [Ljava.lang.Object [on hold]

SQLQuery sqlQuery6= session.createSQLQuery("select contact_id from contacts order by contact_id desc limit 1"); System.out.println("Query:"+sqlQuery6); @SuppressWarnings("unchecked") ...
0
votes
1answer
13 views

multi-user web app with regular DB manipulation

A general question, to get me started how to solve this thing: How do I make sure, that once a DB record has been changed the other users see this in their browsers as well? Or at least upon a ...
0
votes
1answer
13 views

Filling data into .jasper file from a java program

Below is my bean class used for creating table and mappings using hibernate : package org.jasperreports.entitiy; import javax.persistence.Column; import javax.persistence.Entity; import ...
0
votes
0answers
20 views

NullPointerException on @Embedded List

I have an object with this property @Entity public class Professor { ... @Embedded private List<Rating> ratings = new ArrayList<Rating>(); ... } @Embeddable public ...
2
votes
1answer
16 views

Using ID generator “Sequence” or “Table HiLow” based on database

We are using Hibernate 3.2 and cannot upgrade due to dependency on other libraries being used in legacy applications. Currently, "native" id generator is being used in hibernate mapping file for ...
0
votes
3answers
33 views

Cannot update entity using Hibernate

I am using Hibernate with JPA annotated entities and the next code which I expect to update "raw_text" field of an entity doesn't change it. How to achieve the expected behavior? @Override public ...
0
votes
0answers
14 views

Caused by: ERROR 42X05: Table/View 'STUDENTS' does not exist DB on mac

I have been facing a problem since the last 3 weeks. The issue can be seen on a mac. I have instructed Hibernate to create the tables for me, but when executing the application it throws the following ...
0
votes
0answers
13 views

Hibernate-validator ClassNotFoundException

I'm trying to use hibernate-validator in conjugation with hibernate-core. I need upgrade my hibernate version at least 4.2.0 with spring 3.2.1. However when I define in my pom.xml appears the follow ...
0
votes
1answer
29 views

Am using Trigger to get auto increment string in my sql to ID

Am using Trigger to get auto increment string in my sql to ID. POJO class: @Entity @Table(name="CUSTOMER") public class Customer implements Serializable{ private static final long ...
0
votes
3answers
24 views

Hibernate DDL table Dynamic creation

I've a spring boot project, and I'm using hibernate to map my entities to DB, However now I have a new requirement: I need to be able to dynamically create tables in DB, without any mapping (so far). ...
0
votes
2answers
61 views

no persistence provider for EntityManager named persistence.xml

This is not a duplicate as the tag above purports. This question has not yet been answered. I am trying to set up this tutorial to get hyperjaxb to work in an eclipse project. How can I get it to ...
-1
votes
2answers
37 views

Using Hibernate to reverse engineer database - is it worth it? [on hold]

In my company I am currently working on a small java module that will be responsible for very simple operations on MySQL database. To be precise, it will be so limited, that it will only have to ...
0
votes
0answers
42 views

Java Hibernate Sql syntax issue [on hold]

I am trying to find best query, but am getting an exception all the time. That is my native SQL code with hibernate: String query_string = "SELECT g.id AS id, g.createDate AS createDate,g.name AS ...
0
votes
2answers
24 views

How to remove auth request in Spring?

This message says: Required authorization. To access on the server http://localhhost:8080 you should enter login and password. Server message: Spring. I'm using Hibernate 4, Spring 4 and Gradle. ...
0
votes
2answers
38 views

cascade = CascadeType.ALL not updating the child table

These are my pojo class Orderdetail.java package online.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; ...
0
votes
1answer
23 views

Replicating @ElementCollection behavior

Is there anyway I can have the effect of @ElementCollection without actually having this annotation? I am using Hibernate 3.3, while @ElementCollection and @CollectionTable is only supported for ...
0
votes
1answer
16 views

locking a object using hiberante session.load

Hibernate has PESSIMISTIC locking mechanism that can be used to lock a db row. session.lock(Object object, LockMode lockMode) . Lets say i lock a object : 1)session.lock(myObject.LockMODE.READ) ...
2
votes
3answers
50 views

SQL statement to concat strings in MySQL and SQL Server

I worked on hibernate.below code is worked fine in mssql but gives error in MySql Code: Criteria criteria = session.createCriteria(table1.class); ...
3
votes
3answers
10k views

Hibernate org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:

I have the below mentioned Entity classes, when I execute my application I am getting the following exception. Some of the other similar questions didn't solve the problem. WARNING: ...
0
votes
1answer
4k views

org.hibernate.PropertyNotFoundException: Could not find setter for 0

I'm fetching only selected attributes from a table using HQL, maintaining a list of non-entity class objects. For Eg. My entity class: @Entity @Table(name="STUDENT") public class Student { @Id ...
2
votes
2answers
2k views

name attribute in @Entity and @Table

I have a doubt name attribute is there in both @Entity and @Table for example I am allowed to have same value for name attribute @Entity(name = "someThing") @Table(name = "someThing") and I ...
-1
votes
1answer
246 views

Postgresql : Jdbc Bulk insert Vs. Hibernate Bulk Insert

i used Postgresql database for my web application. on each day have to insert around crore of data to database. there are 2 ways to insert into database Bulk Insett using JDBC (EX. Insert into ...
0
votes
1answer
449 views

is it possible to add multi-tenant features to a java application using hibernate 4 and EJB 3.1? [closed]

I'm new to asking questions on stackoverflow, but after a day of searching a solution to my problem, without success, I decided to ask. Is it possible to add multi-tenancy features to a java EE ...
4
votes
2answers
6k views

Strange behaviour with @Transactional(propagation=Propagation.REQUIRES_NEW)

Here is my problem : I'm running a batch on a Java EE/Spring/Hibernate application. This batch calls a method1. This method calls a method2 which can throw UserException (a class extending ...
1
vote
1answer
2k views

NullPointerException when accessing EntityManager

I am using Hibernate4,Spring3 and JSF2 for a small application and Weblogic 10.3.6 as Apps server. In order to enable JPA2 I have added the following in commEnv.cmd @rem Enable JPA 2.0 functionality ...
2
votes
2answers
2k views

Hibernate exception PropertyNotFoundException when using Transformer

I'm using hibernate and hql for querying in my Java codes. But I got an exception like this: Caused by: org.hibernate.PropertyNotFoundException: Could not find setter for 0 on class [my class] at ...
3
votes
2answers
83 views

session.persist() method confusion

I read this in doc: persist() also guarantees that it will not execute an INSERT statement if it is called outside of transaction boundaries. But when I try this code: SessionFactory sessionFactory ...
11
votes
6answers
48k views

How to resolve “failed to lazily initialize a collection of role” exception?

I have the problem with the "org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: mvc3.model.Topic.comments, no session or session was closed" Here is the ...
14
votes
8answers
10k views

IllegalStateException with Hibernate 4 and ManyToOne cascading

I've got those two classes MyItem Object: @Entity public class MyItem implements Serializable { @Id private Integer id; @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) ...
0
votes
0answers
317 views

How to apply detachedcriteria in hibernate for given Query

I use Hibernate 3.0. I want to do group by in detached criteria but i don't want that particular column on which i do group by. My HQL Query is select count(*), ps.purchaseOrderstatus as status from ...
0
votes
1answer
173 views

Apache Solr with Hibernate-Java or with Ms SQL Server

I have Problem with SQl server Performance because of Heavy Calculation query, so we decided that we put Solr as intermediate and index all data from either Hibernate or Direct from SQl server, so ...
180
votes
11answers
106k views

What's the difference between JPA and Hibernate?

I understand that JPA 2 is a specification and Hibernate is a tool for ORM. Also, I understand that Hibernate has more features than JPA 2. But from a practical point of view, what really is the ...
1
vote
4answers
11k views

Hibernate - Complex Query from multiple Tables to one object

i'm working with Java and Hibernate. I have a complex query crossing 7 tables, making some counts and sum with some fields. I need to make the Query using session.createSQLQuery and I would like to ...
119
votes
10answers
75k views

Is buildSessionFactory() deprecated in hibernate 4?

When I updated version of Hibernate from 3.6.8.final to 4.0.0.final I got a warning about deprecated method buildSessionFactory() in this line: private static final SessionFactory sessionFactory = ...
8
votes
5answers
3k views

Is it possible to have immutable fields in Hibernate/JPA?

In our application, we need to have fields that are assignable only once. At first we thought of encapsulating the fields and making the setters private. However, some questions arouse: Without a ...
11
votes
4answers
15k views

“No Persistence Unit Found” error

I am getting the following error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...
17
votes
4answers
22k views

Hibernate saveOrUpdate behavior

Does anyone know how Hibernate knows whether to INSERT or to UPDATE a value in the database when session.saveOrUpdate() is called? So far, I have only determined that it is not dependent on the ...
3
votes
2answers
2k views

@Transactional method called from another method doesn't obtain a transaction

In Spring, a method that is annotated with @Transactional will obtain a new transaction if there isn't one already, but I noticed that a transactional method does not obtain any transaction if it is ...
0
votes
1answer
3k views

DB Connection with MySQL via Hibernate on Embedded Glassfish

I have a problem to connect my MySQL Database via Hibernate/ JPA2 on a Embedded Glassfish. My Environment: Maven 2 Embedded Glassfish (integrated via Maven Plugin) Eclipse + M2Plugin Hibernate ...
22
votes
3answers
15k views

How to turn off hbm2ddl?

I couldn't find a reference on how to switch hbm2ddl off.
9
votes
1answer
10k views

Doing an “IN” query with Hibernate

I have a list of IDs in a String, and want to use Hibernate to get the rows with these IDs. TrackedItem is a Hibernate/JPA entity (sorry if I'm getting the naming mixed up here). My code is: String ...
53
votes
4answers
25k views

hibernate or eclipselink?

It seems like EclipseLink has been chosen by sun as the reference implementation of JPA 2.0, nevertheless I see lots of people continue to use hibernate... I have no experience with any of them, so I ...
7
votes
2answers
2k views

Oracle legacy table without good PK: How to Hibernate?

I have legacy tables in an Oracle database which i'd like to access from a Java application with Hibernate. The problem is: the tables don't have good primary keys. For instance, a table would look ...
3
votes
2answers
13k views

How to fetch hibernate query result as associative array of list or hashmap

I am developing an application in struts 2 and hibernate 3. I have 3 tables Inspection InspectionMission Timeline Inspection is associated with InspectionMission and InspectionMission is ...
73
votes
7answers
42k views

What are the differences between the different saving methods in Hibernate?

Hibernate has a handful of methods that, one way or another, takes your object and puts it into the database. What are the differences between them, when to use which, and why isn't there just one ...