Hello all,
I get a compile error from eclipse with this hibernate query. Below is the code and the picture of eclipse compile error
<sql-query name="endDateChecker">
<return-scalar column="PId" type="java.lang.Long"/>
select
pid as PId
from
info
where
end_date < tr...
I have a problem with getting the list items, below is my hibernate code, after that code there is my method ..and below that is my junit test. How can I make sure that query is executing properly, and how can I check that results actually work .. this query should return couple of pids .. and put them in the list.. now I'm 90 % sure tha...
I need to map the enums which didn't implement the interface beforehand to the existing database, which stores enums in the same table as the owner class using the @Enumerated(EnumType.STRING).
class A {
HasName name;
}
interface HasName {
String getName();
}
enum X implements HasName {
John, Mary;
public String getNa...
Hi,
Is there a way to find out which record caused such a violation in Hibernate?
Normally you add objects to session and at the end you persist them. If such an error occurs it takes a while to track down which record has violated the constraint.
Is there way to find out which record caused (either to "toString() in case of new obje...
I'm not sure if this is possible in Hibernate but it would be really great if it was :) I've not actually got past the conceptual stage with this but I'll explain as best as I can.
I want to make use of Oracle Spatial features to do proximity based searching. Imagine I've got a Location entity which stores a latitude/longitude value. Th...
Under Weblogic 10, I am using Hibernate to store data into several tables with BLOBs. It's always worked fine but the customer found specific circumstances where 15% of the BLOBs have the correct size but only contain null characters. I can't figure out what makes it good or full of emptiness.
The BLOB type I am using does a:
public vo...
I do not understand why Gavin King call org.hibernate.Query an interface.
As long as I know, an interface is a group of related methods with empty bodies and this
'interface' has methods already implemented.
I will appreciate any answer about it.
...
In searching for an answer to an interesting situation which I had recently encountered I came upon the following question: Type safety, Java generics and querying
I have written the following class (cleaned up a bit)
public abstract class BaseDaoImpl<T extends Serializable> extends HibernateDaoSupport implements BaseDao<T> {
/**
...
Why the examples about hibernate use SessionFactory interface instead SessionFactoryImpl class to open a session on the given connection?
...
I have a two classes, Service and Customer, with a many-to-one association from Service to Customer. I want to delete a Customer and any Service that references it. I'm using JPA as the ORM (with Hibernate underneath) attached to a PostgreSQL db.
It'd be great if I could define the association in such a way that deleting the Customer wo...
I would like to hold a ref of some other entity using its identifier.
The object model which I am working on is huge and related entities hold lot of data. Also few pieces are cyclic in nature and I suspect that holding objects directly will be a problem.
So consider following as an example say there are two entities A & B:
Class A
{...
How do I implement paging in Hibernate? The Query objects has methods called setMaxResults and setFirstResult which are certainly helpful. But where can I get the total number of results, so that I can show link to last page of results, and print things such as results 200 to 250 of xxx?
...
The implementing-result-paging-in-hibernate-getting-total-number-of-rows question trigger another question for me, about some implementation concern:
Now you know you have to reuse part of the HQL query to do the count, how to reuse efficiently?
The differences between the two HQL queries are:
the selection is count(?), instead of th...
I'm introducing a DAO layer in our application currently working on SQL Server because I need to port it to Oracle.
I'd like to use Hibernate and write a factory (or use dependency injection) to pick the correct DAOs according to the deployment configuration. What are the best practices in this case? Should I have two packages with dif...
Hi there. I need to write some HQL to do the following...
I have 3 tables: club, team and game (column names below)
=School=
-id(pk)
-name
=Team=
-id(pk)
-name
-club_id(fk)
=Game=
-id(pk)
-opposition
-homeScore
-awayScore
-team_id(fk)
I need to select the last 20 games played for a specified club...
something like: "select last 20...
I'd like to start by apologizing for my unfamiliarity with Hibernate. I'm only recently getting into it and am far from an expert.
I have three tables: Contract, Products, and a link table between them to define a many to many relationship.
I'm trying to write an HQL query to return all contracts that contain a range of products. Un...
We have an application that uses Hibernate's 2nd level caching to avoid database hits.
I was wondering if there is some easy way to invalidate the Java application's Hibernate 2nd level cache when an outside process such as a MySQL administrator directly connected to modify the database (update/insert/delete).
We are using EHCache as...
I'm using Struts + Hibernate + Spring for my project development.
And here is my Spring Context XML file. When I called "sessionFactory.getCurrentSession()" in the beginning of userDao.getXXXX method, the exception whose detail message is "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona...
Hello, I need to use a sequence to get a unique value. The production code uses postgres but I would like to access it via Hibernate so that I can test this with HSQLDB.
How can I create and read a sequence in Hibernate?
...
I have an Object. How can I know if its class is mapped to a table in Hibernate?
...