How to generate id for entity using constructor parameters - is that possible ? I need that to make tree structure (category -> subcategories...) passing to constructor parent category id.
Category category = new Category(parentId);
CategoryDAO.add(category);
...
i am working on some updation in Hibernate application. in which Struts and Spring used.
we do entries of .hbm file in configration file(.cfg file). but when using spring with hibernate app we do entries in application context.xml.
but i can not find configration entries in entire application.
Is there any other class where we configure...
Nearly every table in our database has a FK to the Auditing table which logs created, updated and deleted status (date and username).
We mapped the auditing table to the Auditing class and use it like this:
@MappedSuperclass
public class BusinessObject extends DataObject {
private static final long serialVersionUID = -114781101039594...
Looking for guidance as to what version of Spring, Hibernate and JBoss work together. I am currently using:
<dependencies>
<dependency org="javax.servlet" name="jstl" rev="1.1.2" conf="runtime->default"/>
<dependency org="org.springframework" name="spring" rev="2.5.6" conf="runtime->default"/>
<dependency org="org.springfra...
The dataset I display using PageableListView can get very big and keeping the whole dataset as a model would be very inefficient. Is it possible to load for example only the set of IDs first and then load only the objects that are to be displayed on the current page? I use Wicket+Spring+Hibernate/JPA. Or is there a better approach to pag...
I use server based sorting(in the db) using orderby clause. But now that I want to support multiple locales, how should I pass the locale information to the DB via hibernate layer. I have pre-defined views to which I add criteria and order in the hibernate layer.
...
I am facing issues while retrieving data for entities having bi-directional many-to-many relationship. If I use List for storing entities, I get unable to fetch multiple bags simultaneously error. If i change my code to use Set, I get stackoverflow error.
Details :
Spring 3.0.3
Hibernate-core : 3.5.1-Final
Hibernate-annotations : 3.5....
Hi,
I have three tables (DEVICES, DEVICE_DETAILS and LOCATIONS) which I want to map to two classes (Device and Location).
To do this I use the following hibernate mappings:
Device.hbm.xml:
<hibernate-mapping>
<class name="bo.Device" table="DEVICES">
<id name="deviceId" type="int">
<column name="NR"/>
<generator cl...
I know that deleting orphaned child objects is a common question on SO and a common problem for people new to Hibernate, and that the fairly standard answer is to ensure that you have some variation of cascade=all,delete-orphan or cascade=all-delete-orphan on the child collection.
I'd like to be able to have Hibernate detect that child ...
Our project is an Eclipse RCP application using Hibernate as an ORM. I recently learned about JFace databinding, in which the GUI and data models can be synchronized automagically.
I put together a short test implementation along the lines of Lars Vogel's excellent JFace Data Binding Tutorial and was fairly impressed with the framework...
I just discovered a strange problem when dealing with HQL queries on nested objects.
My class looks like this:
class MyClass {
MyClass predecessor
}
So using predecessor, I can build a Hierarchy. Now let's say I have a "thin" tree like this:
obj1.predecessor = null
obj2.predecessor = obj1
obj3.predecessor = obj2
obj4.predecessor =...
Ok I have a 1-to-many mapping between a parent and child class. I can save the parent and it will automatically save the children objects, but problem is when doing a SELECT on the parent class. It seems that I'm getting a Parent object for every Child object in database table.
So if I save 1 parent object with 2 child objects, when I u...
From what I've read so far I had the understanding that using transactions would be the solution to hibernate's lazy loading problems. The session would be available during the whole transaction in the service layer without further adue.
So maybe I misconfigured my transaction management? I'm actually a newb when it comes to spring and ...
Dear All,
I just start reading Sun's JDBC tutorial. I installed MySQL Connector/J and was just skimming through its menu, then came across this statement:
"Although JDBC is useful by itself, we would hope that if you are not familiar with JDBC that after reading the first few sections of this
manual, that you would avoid using naked JD...
I am getting an exception:
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
I found a list of JDBC Data type here Apache DB Project . How do I find out "-9" maps to one of the data types listed? From googling, people seem to say -9 represents nvarchar, but is there an authoritative source?
...
Hi I have 3 tables as following
1) User has userId
2) UserProductEntitlement has userId and productId and a boolean
3) Product has productId
This is my class representation :
@Table(name="User")
class User
{
@OneToMany(fetch=FetchType.EAGER, targetEntity = ProductEntitlement.class, cascade=CascadeType.ALL)
@JoinColumn(nam...
I'm using XStream to convert my Hibernate entities to XML.
All the entities were properly converted to XML until I changed the attributes to LAZY fetching. I see problems in aliasing.
I see some javassit code. However, this is happening to only one node. As you
can see, for the "id2" it has aliased properly.
<foo>
<domain id="domain...
org.hibernate.hql.ast.QuerySyntaxException: cannot dereference scalar collection element: cspName
st.append("SELECT customers.name,sum(csp.cspValue) as TotalMoney ");
st.append("from Account as account ");
st.append("left join account.CSPFields as csp with ((account.accountID=csp.id) and (csp.cspName = 'Target')...
Is it possible put these three framework Spring, Struts 2.0 and Hibernate in single application and how without using JPA?
...
I am trying to figure out the most efficient / effective way of performing a certain type of query using Grails GORM.
This is the scenario where I want to query all of the children / linked items in a many to one relationship. This is a one way relationship whereby the many side used the id of the thing it is linked to.
One example in...