Tagged Questions
0
votes
0answers
4 views
hibernate-orm source import intellij idea 12
I cloned hibernate-orm project and trying to import it in Intellij Idea 12 and 13.
Everything is working, but classes which use antlr, like HqlSqlWalker doesn't compile because it can't find ...
-2
votes
2answers
22 views
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session
I'm using Spring3.2.4 and Hibernate 4.1.9 . Please help me to findout the solution as early as possible.
Whenever I'm using sessionFactory.openSession() or sessionFactory.getCurrentSession() I'm ...
-2
votes
0answers
15 views
java.lang.IllegalStateException: No WebApplicationContext found: initializer not registered? [duplicate]
I google alot and found many question about this issue but no solution solved my problem. Please if any one could resolve my problem
in web.xml
is classpath:applicationContext.xml
listener ...
0
votes
1answer
22 views
Hibernate-Mysql exception on a read loop
I got this exception during a select "get" query loop.
session.get(Entity.class, id);
Can you tell me how to avoid this?
2014-01-21 18:54:36 [WARN]SqlExceptionHelper:143 SQL Error: 0, SQLState: ...
0
votes
2answers
30 views
Inner join using Hibernate?
I have a User:
@Entity
@Table(name = UserEntity.TABLE_NAME)
public class UserEntity {
...
private List<TeamEntity> teams = new ArrayList<TeamEntity>();
...
...
0
votes
0answers
7 views
Hibernate Search in Windows Azure
I have a Worker Role in Windows Azure where I run a Java application. In order to do not affect the SLA, we need to have at least two instances of this worker role. I'm using Hibernate Search 3.4 in ...
0
votes
1answer
27 views
How do I escape the colon (:) in a mysql query over jdbc that contains a variable assignment?
I'm trying to run a query that involves a custom variable over JDBC toward a MySQL 5.0 database (Hibernate 4 as the ORM):
SET @rownum := 0; SELECT rnum FROM (
SELECT (@rownum := @rownum + 1) AS ...
0
votes
1answer
28 views
How to write Java code that is synchronized on an instance of an entity
I'm using Hibernate and Spring and I want to write Service code to cater for the scenario where, in two separate threads, a DAO is used to fetch an entity instance by id, and it is the same id / ...
2
votes
1answer
29 views
HQL select from multiple tables
I have two tables/POJO's Person and Child that are relational via a String variable. I am getting this error:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
For this HQL ...
2
votes
0answers
34 views
Should a common database/dao methods be static?
I have a method that is used 3-4 times within my code from various locations. Usually one would introduce a static utility method for this, which I also did.
But I wonder if this is a good practice, ...
2
votes
1answer
19 views
Marshal model in different ways using JAXB
Sure, this question was asked before anywhere but didn't find a appropriate solution for it:
Is there a possibility to marshal a model with JAXB to different XMLs or in different ways. I still ...
2
votes
1answer
11 views
Tools for debugging hibernate config
I get the below distinctly unhelpful stack trace when calling configureSessionFactory. I am assuming it cant find the driver, but it's there (I can import them in the same code). I've tried both ...
0
votes
1answer
16 views
Mapping result of Hibernate query to object
I have two classes:
public class User {
String name;
String surname;
}
public class ValueDto {
User user;
Integer value;
}
My query code:
String queryText = "SELECT DISTINCT a.* ...
0
votes
0answers
11 views
Getting old value from first level cache in Hibernate
I was going through first level caching in Hibernate.
Two same calls to load the session i.e. session.load() will hit the database only once as the second will get the data from first level cache.
So ...
0
votes
2answers
21 views
@GeneratedValue Annotation, Constructor value
I can not seem to find any documentaion on how to use the GeneratedValue annotation when it comes to initialising my object.
here is my id field for my object class, I have two other fields which I ...
0
votes
0answers
28 views
Spring + Hibernate best practice to reach scalability
I am little confuse with hibernate and spring configuration, if I am using hibernate 4 and spring 3, I read on other post that the best way is using LocalContainerEntityManagerFactoryBean and ...
0
votes
3answers
26 views
HQL String LEFT
How do I get records that first 4 characters' match my string using HQL?
This is my HQL statement:
Query query = HibernateUtil.getSessionFactory().getCurrentSession().createQuery("from User where ...
0
votes
2answers
20 views
How to display text value inserted using Hibernate in pgAdmin3?
I have a table, which has a column "description" of type TEXT. If I do:
SELECT id, description FROM table_name;
I see in "description" column instead of text value a number. Is there any way to see ...
0
votes
1answer
18 views
Reattaching an entity to lazy load a collection (JPA/Hibernate)
Can anyone help me with a JPA issue that I thought would have been simple. I'm trying to write a general-purpose lazy load manager in my JPA persistence framework, so layers higher up the application ...
0
votes
3answers
21 views
what is difference between hibernate.jdbc.fetch_size and hibernate.jdbc.batch_size?
I am trying to tune my application, came across some blogs speaking about the batch fetch and batch select and putting my understanding as follows.
hibernate.jdbc.fetch_size - Used to specify number ...
0
votes
3answers
28 views
How to create variable pattern matching for database lookup?
I'd like to find a table row where the desired value has the form of A9-B19-C12-D1. Thus, variable letters followed by variable digits, devided by - each. The length is not fixed, eg it could also be ...
0
votes
1answer
23 views
Weird behavior with java, hibernate.initialize()
I am noticing a weird behavior when I perform some basic checks using objects that have been .initialize()'ed using Hibernate.
The following 'if condition' fails even when it is supposed to pass:
...
0
votes
1answer
12 views
How to remove warning in hibernate in netbeans 7.4
I am working on hibernate with Netbeans. When I run the file, it is running is successfully but generates warning
3 [AWT-EventQueue-0] INFO org.hibernate.annotations.common.Version - Hibernate ...
0
votes
2answers
21 views
Java NamedQuery and set date as parameter
I've created simple @NamedQuery in Entity:
@NamedQueries({
@NamedQuery(name = ProductChangeLog.GetByDate, query = "From ProductChangeLog where date = :date ")
})
date is a Date.sql
And i ...
1
vote
3answers
46 views
How to create/call a sql view in Hibernate
Here is the view created in document.hbm.xml
<database-object>
<create><![CDATA[CREATE VIEW docView
AS
SELECT * from document;
GO]]></create>
...
0
votes
0answers
6 views
running Hibernate 4.3 with JMX (without spring)
I'm running a java webapp (wicket 6.13) using Hibernate 4.3 and Guice 1.0
I'm trying to configure Hibernate so that I can access runtime information via the JMX framework.
I'm not using spring, can ...
0
votes
0answers
23 views
Hibernate: get current value of an @GeneratedValue
I have an entity with a @Id created by @GeneratedValue using a database sequence. I set allocationSize = 1000. So the values are cached by hibernate.
The entity has a non-nullable name field and if ...
0
votes
0answers
15 views
Dropwizard:“error processing your request” for retriving data from database
When i tries to open
http://localhost:8080/tailor/orders
which should return all the orders in database.but it's generating error
{"message":"There was an error processing your request. It has ...
0
votes
0answers
14 views
Spring MVC, DTO'S, Entities architecture with multiple repositories
I am trying to find best practice approach for handling simple CRUD operation.
but this time I have more than one repository type(hibernate(mysql), ldap)
I have UserDTO:
public class UserDTO {
...
0
votes
2answers
23 views
One Id of composite key to be referenced in another entity
Table 1 has only two columns which form a composite key.
Table 2 id column is being generated.
Value for one property of Table1 I am supplying and for second property I need it to pick up the ...
1
vote
1answer
21 views
My child table is not deleting
This is my entity file. Here I have used bidirectional mapping my requirement is,If I delete parent I want delete both parent and child and If I delete child i want to delete only child not parent. ...
0
votes
3answers
35 views
how to update the table in java using hibernate without using hql and sql
I have tried a lot to update my table using hql but i didn't find the solution , i have searched on internet too, I am new in java and hibernate please help me to find the solution.
my code is ...
-1
votes
0answers
16 views
How to display data from database in a TableView
FIRST TRY -> When I do:
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
kiwiid.setCellValueFactory(new PropertyValueFactory<NewBeautifulKiwi, ...
0
votes
1answer
11 views
Disabling implicit transactions in Hibernate
I'm new to hibernate and I've written the following code,
package main;
import java.util.List;
import model.Message;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import ...
0
votes
1answer
16 views
Why does GORM/Hibernate convert string parameter to TRUE?
I'm using Grails 2.2.3
I'm trying to do a Like product search
Domain object maps to a legacy JDE table and is:
class JdeProduct {
String itemNum
String searchText
String description
...
0
votes
1answer
30 views
Hibernate / SQLException: field doesn't have default value
mySQL Table generated using:
CREATE TABLE `actors` (
`actorID` INT(11) NOT NULL,
`actorName` VARCHAR(255) NOT NULL,
PRIMARY KEY AUTO_INCREMENT (actorID)
);
Mapped class:
@Id
...
0
votes
1answer
18 views
JPA 2: Referential integrity constraint violation while saving entity with undirectional OneToMany relationship
I'm working on database design and Java implementation of some sports event model.
I have two entities: Game and Participant and undirectional OneToMany relationship between them. Game can has many ...
1
vote
1answer
29 views
compatability of spring 4.0.0 with hibernate 4.30
I am using Spring 4.0.0 RELEASE jars, hibernate-coe 4.3.0 jar in my spring + hibernate project.
I am facing an error with org.hibernate.engine.FilterDefinition is not found. Actually in old hibernate ...
-2
votes
0answers
21 views
java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition [on hold]
Caused by: java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown ...
1
vote
1answer
17 views
How to add Struts 2 business service
Today I sat for practical test for a job. In that paper they were ask to create small web application for submit some data to DB and separate layers(MVC) correctly.
So I used Struts 2 and spring and ...
0
votes
1answer
24 views
Hibernate: C3P0 properties ignored
I'm getting the following warning:
15:41:51,043 WARN [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-1) HHH000022: c3p0 properties were ...
0
votes
1answer
17 views
Hibernate L2 query cache: do not hit database on cache miss
I have a table, Users with primary key id :: int4 and natural key password :: varchar(32). I'd like to check existence of a row by compund id and password in DB as fast as possible using Hibernate.
...
1
vote
1answer
34 views
Hibernate Exception: Missing Column (column exists)
Okay, so within the database we have a table called distributionCompanies, created like so:
CREATE TABLE `distributionCompanies` (
`distributionCompanyID` INT(11) NOT NULL,
...
1
vote
2answers
47 views
Hibernate HQL casting java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
I am new in Hibernate.
When i try to inverse boolean
@Query(value = "update ToDo t set t.done= (abs(t.done -1)) where t.id=:id")
public void toogleDone(@Param("id") long id);
i have this ...
0
votes
1answer
33 views
java hibernate aggregation error
qty|price
1 | 4
4 | 5
6 | 4
2 | 3
1 | 2
are entries on the database. i am trying to get the result: (group quantity by price)
qty|price
7 | 4
4 | 5
2 | 3
1 | 2
I am successful when i do this ...
0
votes
0answers
21 views
Hibernate @DynamicUpdate(value=true) @SelectBeforeUpdate(value=true) performance
i am start using this 2 hibernate annotations in my APP.
@DynamicUpdate(value=true)
@SelectBeforeUpdate(value=true)
first i will try to explain what i understand about it to know if i am right ...
0
votes
0answers
19 views
TableView doesn't show database items [duplicate]
FIRST TRY -> when I do:
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
kiwiid.setCellValueFactory(new PropertyValueFactory<NewBeautifulKiwi, ...
0
votes
0answers
25 views
Hibernate and c3p0: unexplained why client is unable to communicate after some time
Running the following code...
Session session;
try {
session = sessionFactory.openSession();;
// Query the DB for a list of sms to be sent
Query query = ...
3
votes
1answer
31 views
Access EntityManagerFactory in grails
How can I access EntityManagerFactory in a grails web application or any other persistence unit?
I could access it with name by below code if a had a persistence.xml config but grails hides most of ...
-3
votes
1answer
28 views
How to use cascade type save,delete, update in hibernate annotation
Can any one explain me the hibernate annotation how to use different types of cascade like delete,upadte,save-update?
How can I make sure that when an Owner is deleted, its car is deleted as well ...