let's see if I can ask this in an understandable way...
I started with grails and created a domain class called user. As far as I understand, Hibernate is used to map this domain class to the database. This works pretty fine with hsqldb.
Now I tried to switch to javaDB and get an error message because the table is called "user" (which ...
I'm using Hibernate Search (which uses Lucene) for searching some Data I have indexed in a directory. It works fine but I need to do a reverse search. By reverse search I mean that I have a list of queries stored in my database I need to check which one of these queries match with a Data object each time Data Object is created. I need i...
I'm talking about a detached object, that later I want to update with saveOrUpdate().
How can we at the same time set null and clear() a referenced collection?
A [1:1] B [1:M] C
B to C reference can be null, that means NO C's records for B.
now I want to be able at the same time set B to null so that all C records were deleted from a...
Hi,
I have a table with two primary keys,how can i map the same in hbm mapping file.How to define two primary keys.
...
@Entity
@Table(name = "USERS")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "USERNAME", nullable = false, length = 20)
private String userName;
@Column(name = "PASSWORD", nullable = false, length = 10)
private String password;
@Column(name = "Date", nullable = false )
...
Can I perform a Criteria query with Sub-Select AND Left-Outer join?
For example, I have A 1-many B 1-many C.
With Criteria.createAlias ("b", "b", Criteria.LEFT_JOIN) I can perform Left Outer join.
With Criteria.setFetchMode ("b", org.hibernate.FetchMode.DEFAULT) I can perform Join with the default fetching strategy. I assume that hav...
Assuming the DAO structure and component interaction described below, how should DAOs be used with persistence layers like hibernate and toplink? What methods should/shouldn't they contain?
Would it be bad practice to move the code from the DAO directly to the service?
For example, let's say that for every model we have a DAO (that ...
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate 3.5.1, JPA 2, and Derby. I am defining all of my database connectivity in persistence.xml and merely using Spring for dependency injection. I am using embedded Derby as my database.
Everything works correctly when I define the driver and url pro...
I lack understanding of how does the generated proxy class object (CGLib enhanced POJO) is transferred to the remote client and still retains its ability to generate Lazy Init. Exceptions.
Does that mean that there is some kind of contract that all the transferred objects of some kind of class (a proxy) will be reinstantiated as proxies...
Collection.clear() will delete children whenever Session flushes.
What about OneToOne? Setting to null is not a correct way. No clear() method for OneToOne exists.
Table_A has a column (not its PK!) that OneToOne references Table_B.
I wonder if Hib works as expected in my case?
My Cascading options are set to "all,delete-orphan".
Ta...
I do not use HibernateTemplate, but work with getCurrentSession() in my DAO.
I would like to know how to declare Hibernate named queries in a beans.xml file (I do not use hbm.xml).
And maybe Spring has alternative means to declare Hibernate named queries?
...
I'm building a desktop application using hibernate 3.5 & JPA 2.0.
I have 2 jars,
the lib, which defines every entity and DAO, packages looks like this :
org.my.package.models
org.my.package.models.dao
org.my.package.models.utils
In org.my.package.utils I defined my hibernate utility class for getting EM & EMF instances, which mean...
I'm gonna go with this design:
create an object and keep it alive during all web-app session.
And I need to synchronize its state with database state.
What I want to achieve is that :
IF between my db operations, that is, modifications that I persist to a db
someone intentionally spoils table rows, then on next saving to a database
...
I need a generic Criterion which forces the result to zero matches.
Something like Restrictions.eq(true, false) ?
...
Hi All,
I am having a designation table with d_name as primary key which i am using in user table as foreign key reference .I am using hbm for mapping in designation hbm i have id defined as d_name mapped to database column .I am getting a error saying
"integrity constraint violation(user_designation_fk) parent key not found. "
Wher...
I'd like to program against interfaces when working with NHibernate due to type dependency issues within the solution I am working with.
SO questions such as this indicate it is possible.
I have an ILocation interface and a concrete Location type. Will the following work?
HBM mapping:
<class name="ILocation" abstract="true" table="IL...
We use Hibernate with the following version definition for optimistic locking et. al:
<version name="version" access="field" column="VERSION" type="long" unsaved-value="negative"/>
This is fine and dandy; however, there is one small problem, which is that the first version for some entities is '0', and for others, it is '1'.
Why this...
I have a byte[] member in one of my persistable classes. Normally, I'd just annotate it with @Lob and @Column(name="foo", size=). In this particular case, however, the length of the byte[] can vary a lot (from ~10KB all the way up to ~100MB).
If I annotate the column with a size of 128MB, I feel like I'll be wasting a lot of space for t...
Hello, i'm trying to update the hibernate dependecy in my pom, I had the 3.3.2.GA version and i changed to 3.5.1-Final. But maven can't find the jars in the repo, so checking the url.
http://repository.jboss.org/maven2/
in the hibernate section.
I can see that there are't any jar, only pom's. But If i check the entity manager section
...
I'm trying to use Hibernate to persist a class that looks like this:
public class Item implements Serializable, Comparable<Item> {
// Item id
private Integer id;
// Description of item in inventory
private String description;
// Number of items described by this inventory item
private int count;
//Category item belongs to
private ...