I am trying to reference some child entities with part of the parents composite key not all of it, why cant I? This happens when I use the following mapping instead of that which is commented.
I get the following error
Foreign key in table
VolatileEventContent must have same
number of columns as referenced
primary key in tabl...
Hi,
See the following mapping
public class SomeClass {
private Integer someField;
}
When i call the following query
select someField, count(*) from SomeClass inner join OtherClass... group by ...
And i proccess the query as follows
Map<Integer, Integer> result = new HashMap<Integer, Integer>();
List<Object> objectList = qu...
EDIT: I've edited this post completely, so that the new description of my problem includes all the details and not only what I previously considered relevant. Maybe this new description will help to solve the problem I'm facing.
I have two entity classes, Customer and CustomerGroup. The relation between customer and customer groups is M...
Let's say Student is the parent class in an inheritance hierarchy that includes ComputerScienceStudent and ITStudent. Student defines a field called favoriteColors, which is a value-typed collection of Strings. Using the criteria API I'd like to query for all students who list "blue" as one of their favoriteColors.
Here is the relevan...
Hello,
I'm new to JPA and I'd like to know if it is possible to stream data from a result set, I mean I do not want to wait that the query is performed to start dealing with first results, for instance in the case of a batch.
Is there any possibility using the JPA API or any community adopted workaround ? Eventually using a feature of ...
I have a database with existing data, where previously I've been using AUTO_INCREMENT on the db to generate the PK.
To improve performance and facilitate bulk inserts, I'm trying to introduce a different key generation strategy:
public class BaseEntity implements Serializable {
@Id
@GeneratedValue(generator="generator")
@GenericGener...
Hi Guys,
I'm facing a problem with Hibernate.
My current project is a little game. In this game you have a Board which has many Fields each with a Token.
I can make a select on an empty database without any problems but if I put one object into it (saving works without any exceptions and after it the database values looks good) I'm getti...
I wanna design an Entity Class which has a String[] property. This String Array always has two values and I dont want Hibernate (or rather JPA) create an extra table for this but embed this two String values directly into the table.
Is this possible and if so how?
...
I am running Hibernate 3.2.0 with MySQL 5.1. After updating the group_concat_max_len in MySQL (because of a group_concat query that was exceeding the default value), I got the following exception when executing a SQLQuery with a group_concat clause:
"No Dialect mapping for JDBC type: -1"
-1 is the java.sql.Types value for LONGVARCHAR....
I have a table Users
CREATE TABLE "USERS" (
"ID" NUMBER NOT NULL ,
"LOGINNAME" VARCHAR2 (150) NOT NULL )
and I have a second table SpecialUsers. No UserId can occur twice in the SpecialUsers table, and only a small subset of the ids of users in the Users table are contained in the SpecialUsers table.
CREATE TABLE "SPECIALU...
It seems that org.hibernate.cfg.Configuration object can be used to perform validation programmatically, by calling the validateSchema method.
However, this method needs dialect and databaseMetadata objects.
I am using Spring and I can get a hold of AnnotationSessionFactoryBean object from spring context. So far I have the following co...
I have Hotel entity:
class Hotel {
City city
}
Now, i need count of hotels with given city.
It could be done in this way:
def hotels = Hotel.findAllByCity(city)
def cnt = hotels.size()
But it's very dirty way. It seems that with criteria it would be better, but i have no idea how to implement it...
...
Using annotations how do you map a field in an entity which is a "Map" (Hashtable) of String to a given object? The object is annotated and instances of it are already stored in the hibernate databse.
I've found the syntax for definging a map with a simple key and value as such:
<class name="Foo" table="foo">
...
<map role="age...
i get this hibernate warning pretty much every time i deploy a persistence unit on JBoss. its never the cause of any issues, but i was wondering if anyone knows what exactly this means, and can it be fixed/slicenced/worked-around in some way.
...
Where I'm working the guys that are sitting across from me are working on a project. This is a JavaEE app which uses Struts, Spring, EJB 3.0, JPA, and Hibernate 3.0. They are using EJB 3.0 entity beans with annotations. I've been asking them why Hibernate 3.0 is in this mix and noone can seem to tell me. It feels like they've include...
Hi.
I'm writing a criteria that should group the results by a property of a related entity. I've tried using an alias, tried using the property path itself, but so far I get nothing.
say my classes are (rough sketch):
class A{
@ManyToOne(...)
B b;
}
class B{
@OneToOne(...)
C c;
}
class C{
String s;
}
and I want a criteria that r...
Any ideas on how to persist a collection of enums in Grails?
Groovy enum:
public enum MyEnum {
AAA('Aaa'),
BEE('Bee'),
CEE('Cee')
String description
MyEnum(String description) {
this.description = description
}
static belongsTo = [tester:Tester]
}
I want to use this enum in a Grails domain class. The domain class l...
I have the following query in oracle that I want to use in hibernate but cannot work out how to use the rownum variable in an inner query. The query is as follows:
select emp.prof_key, emp.prof_display_name
from empinst.emp emp
where emp.prof_key IN (select x.object_key
from (select event.object_key as object_key
...
Is it still possible to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist? In my properties file, I set
hibernate.bytecode.provider = cglib
But this doesn't seem to do it. Any thoughts?
...
I have the following POJO with a Set inside:
class Word {
private Long id;
private String word;
private int type = WordListFactory.TYPE_DEFAULT;
private Set<Word> refs = new HashSet<Word>();
...
}
Here's the mapping XML:
<class name="kw.word.Word" table="word">
<id name="id" column="id" unsaved-value="null...