This seems like it should be a pretty simple question, or at least have a simple answer. But - I'm really not a database guy, and I'm still pretty far down on the Hibernate learning curve. That said, here's the setup:
Consider a unidirectional many-to-many relationship between two entities, from Foo to Bar:
(pardon any typos below, th...
Hi @ all,
I am concerned with a problem regarding criteria and hql.
In first step a complex criteria construction limits a big amount of datasets.
In second step a hql calculation should be performed on these preselected datasets of step one.
The problem is that the code of both has been developed seperately and i am wondering if it is...
It looks like that Hibernate started using LONG data type in version 3.5.5 (we upgraded from 3.2.7) instead of CLOB for the property of type="text".
This is causing problems as LONG data type in Oracle is an old outdated data type (see http://www.orafaq.com/wiki/LONG) that shouldn’t be used, and tables can’t have more than one column ha...
hi, consider hibernate-link and JTA as peristence provider. How can I force em not to flush anything, and to handle it by myself?
@Stateless
public class SomeBean{
@PersistenceContext
EntityManager em;
public void method(){
em.persist(entity); // will get managed
em.clear(); // everything gets unmanaged
}
}
I would ex...
Question regarding Hibernate Polymorphism and extending a parent class (which I can not modify directly). My parent class is called Contact:
@Entity
@Table(name="contact")
@Inheritance(strategy=InheritanceType.JOINED)
public class Contact {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public long id;
public String name;...
Anybody has an idea why adding the annotation-driven declaration leads to the aopalliance classes not found. I have not explicitly defined the weaving so using Spring defaults.
Any help is appreciated
...
I'm new to NHibernate, and am trying to map a domain model that has a bit of inheritence etc (see this question for full details on my model, starting a new question as this is a different error)
My base class has some abstract methods that each class beneath has to implement. This appears to be causing problems with NHibernate, even th...
Hello,
Lets say I have two domain classes:
class User {
String name
Role role
}
class Role {
String name
static belongsTo = [user: User]
}
and I create some records:
def r1 = new Role(name: "role1").save()
def r2 = new Role(name: "role2").save()
new User(name: "user1", role: r1).save()
new User(name: "user2", role: r2).save...
Given:
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="postType", discriminatorType=DiscriminatorType.STRING)
public class Post {}
@DiscriminatorValue(value = PostType.BUG)
public class BugReport extends Post {}
That is ... Bugs start life in this system as a Post. Later, they can be promoted(?) to bei...
Can i find any example of Java Hibernate in which have delete the data from multiple tables.
...
Hi guys,
I've got an entity Case that has an id CaseId (unfortunately a string due to compability with a legacy system). This id is foreign key in the table Document, and each Case can have many documents (onetomany). I've put the following in my Case entity:
@Id
@Column(name = "CaseId", length = 20, nullable = false)
private String ca...
Can i find the example of batch processing in java hibernate so that i can run delete queries on two tables.
...
I have a class A{Set b .....} which holds references of class B as Set. It is one to many relationship.
Both class have sequencer in oracle. I put cascade to all in hibernate annotations. When i save class A, it gives me error that cannot insert null B.a_id . A-id is not nullable in my database. How can i persist this relatioship.
...
I've got an HQL statement like this:
select new map (f1 as field1, (select ...) as field2)
from ...
where ...
order by field2;
It fails saying "Unknown column 'field2'". I experienced this in general that when using the "new map" statement, I can't reference the map names in the order by field.
As HQL subqueries are only allowed in t...
Hello,
I am having troubles with generating database schema with Hibernate Tools. This is my ant file
<project name="Schema generator for MySQL database" basedir=".">
<description>
This file is used for running Hibernate Tools Ant task.
It is used to generate database schema based on hibernate configuration
</description>
...
Hi,
i'm planning a historization for my java webapp (spring, hibernate).
By googling I found Hibernate.Envers, which seems to be the perfect solution for me.
Are there any comparable solutions?
Thanks a lot!
Jean
...
We have the following entity relationships where a User belongs to a particular Organization. My queries either look like "select * from User where org=:org" or "select * from User where org=:org and type=:type"
I have separate indexes on the User class. The first query will be fine, because of the Index on the foreign key element. Does...
Hi all,
I am working on a project which uses Java,Spring and Hibernate.
I just came across a situaition like this.
bean 1 :
<bean id="cat" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>cat</value>
</list>
</property>
...
In my application I have two table, Group and Role, that are related between them with a @ManyToMany relationsheep. Since each Group can have many Roles and each Role can have many Groups.
The first one:
@Table(name = "groups")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Groups {
private Set<Role> ro...
Hi All,
I'm having trouble creating a model for a couple entities that is sane in both Hibernate and the Database. Any help is appreciated.
A company entity and table exists, which provides both a company name and a "company code". The company code must be unique.
Company's may act as 2 different entities, clients or partners.
We'd ...