Hi guys,
I'm mapping a proprietary database to Hibernate for use with Spring. In it, there are a couple of jointables that, for entity A and entity B have the following schema:
CREATE TABLE AjoinB (
idA int not null,
idB int not null,
groupEnum enum ('groupC', 'groupD', 'groupE'),
primary key(idA, idB, groupEnum)
);
As you ca...
Does hibernate has support for hierarchical data in a database where
you use a parentId
you use a parentId and an orderId
you use Modified
Preorder Tree Traversal
...
Entity A and B have a many to many relationship using link table AtoB.
If Entity A is deleted, the related links are deleted by hibernate. So far so good.
My problem is that my link table is a view hiding a much more complicated relationship and works perfectly in this situation except when hiberate tries to delete the link rows from t...
I'm using Envers to audit different fields of my entities. The framework works in general but it seems to have problems with some kinds of entity mapping. All former problems I could solve myself... but this time I'm stuck.
When inserting some entity into the database I get the following exception:
Caused by: java.lang.NullPointerExcep...
I'm still quite new to NHibernate and most of it I'm getting to grips with. One area that I'm really lacking a proper understanding of though is querying (at least when it comes to anything reasonably complex).
I learn best by example, but I feel that I haven't really been able to find all that many in depth querying examples on the we...
Hi
I am trying to use Criteria API in following scenario:
I have two tables, Schedule and Route (with their classes and mappings).
Route has many-to-one relationship with Schedule.
Route has an integer property sequence.
Now I need to fetch all those Schedule objects whose associated Route objects fulfill the following condition:
r...
Dear All!
I have a painful problem regarding Java Hibernate.
I have my own POJO classes in my modell, and I would like to submit query from an instance of that class, to a table of my relational DB. The problem is, that I want to submit several different queries to different tables. For example:
I have a Bus class, representing buses. ...
I need to make project with Spring + Hibernate, where I could find good example project how basic things are done?
...
what is similarity and difference between jpa and hibernate.
...
I'm having a major problem getting a parent/child relationship working for a hierarchy of a single class. Basically I have to represent a server tree like thus:
Server A
Server B
Server C
Server D
Server E
Server C
Server D
Server F
Server G
Note that the children of Servers B & E are th...
Hello good people!
i've hit a block once again with hibernate.I've posted numerous times on different aspects of the user and contact management that i've been building.
The sad thing is that i didn't really have the time to play with it and understand it better before actually starting working with it. Sorry but English is not my ...
Ok, this question is best explained in code. So will try to present the most succinct example I can.
Timestamped.java
@Embeddable
public class Timestamped<E> {
private E value;
private Date timestamp;
...
}
Foo.java
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="TYPE")
public class...
What's the best/easiest way to generate *.hbm.xml files from pojos?
...
Is the database generated by Hibernate when using ormsettings.dbcreate = "dropcreate" good for production use?
My Case:
Basically were designing the database, and i thought it would be cool to design the objects and have hibernate create the database for me.
...
Hi,
I created a small desktop project using Hibernate, to understand how enterprise patterns are applied in there.
I'm using annotations, and wrote a class to wrap my session factory
public class Hibernation {
private static final SessionFactory sessionFactory;
static{
try{
//sesionFactory = new org.hibernate.cfg....
Hi guys,
When I write a HQL query
Query q = session.createQuery("SELECT cat from Cat as cat ORDER BY cat.mother.kind.value");
return q.list();
Everything is fine. However, when I write a Criteria
Criteria c = session.createCriteria(Cat.class);
c.addOrder(Order.asc("mother.kind.value"));
return c.list();
I get an exception org.hibe...
How do I setup a basic OneToMany relationship using a List and get Hibernate JPA to manage the sequence index number of the list automagically? Can this be done?
This is my test case (more or less);
@Table(name="Policy_Root")
public class PolicyRoot extends BaseDomainModel {
private List<Policy> policyList = new ArrayList<Policy>(...
I have very simple persistance.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">...
hi. I would like to query using hibernate given a particulay query string
I did it like this:
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
List<String> result = session.createQuery("Select item_value from cb_items").list();
session.getTransaction().commit();
session.clear();
return result;
...
so, i am really clutching at straws for ideas here. (also note: this is an intermittent problem)
i have a 'parent' object with a collection of 'child' objects:
<parent stuff>
...
<set name="children" inverse="true" order-by="child_id">
<cache usage="read-write"/>
<key column="parent_id"/>
<on...