Have been trying the whole day long and googled the ** out of the web ... in vain. You are my last hope:
Here's my code:
The Entity:
package sas.test.model;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Employee {
@Id private int id;
private String name;
private long salary;
publi...
I am interested in how hibernate.hbm2ddl.auto=validate actually works and I am struggling to find comprehensive documentation.
We've recently discovered production system was affected by http://opensource.atlassian.com/projects/hibernate/browse/HHH-3532 (Hibernate matches foreign keys on name, rather than signature and so will recreate ...
Which ORM supports a domain model of immutable types?
I would like to write classes like the following (or the Scala equivalent):
class A {
private final C c; //not mutable
A(B b) {
//init c
}
A doSomething(B b) {
// build a new A
}
}
The ORM has to initialized the object with the constructor. So it is possible ...
Hi,
I have two entities: "Parent" & "Child"
Child is mapped in Parent like this:
Code:
<many-to-one name="child" class="org.demo.Child"
update="false" insert="false" embed-xml="false" node="chd/@id" >
<column name="CHILD_ID" precision="10" scale="0" not-null="true" />
</many-to-one>
and Child has an Enum type mapped ...
Does Hibernate use cache (second level or otherwise) if all I am doing is batch inserts?
No entities are being requested from the database, and no generators are used.
Also, would StatelessSession vs Session change the answer? What if I was using a Session with a JDBC batch size of 50? The cache I will be using is Ehcache
...
Suppose a Table per subclass inheritance relationship which can be described bellow (From wikibooks.org - see here)
Notice Parent class is not abstract
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Project {
@Id
private long id;
// Other properties
}
@Entity
@Table(name="LARGEPROJECT")
public class ...
Hi,
I had a problem where I was using the hibernate template to do most of my DB work but I had a part of the system that directly accessed the session to do batch persisting. I noticed that the hibernate template session was old and would be storing cached values which didnt take into account the objects save with the session directly.
...
I am trying to implement JUnit tests for a class that performs DB queries using Hibernate. When I create the class under test, I get access to the session through the factory by doing the following:
InitialContext context = new InitialContext();
sessionFactory = (SessionFactory) context.lookup(hibernateContext);
This works fine when ...
I've got a class hierarchy mapped using table-per-subclass, and it's been working out great:
class BasicReport
{
...
}
class SpecificReport : BasicReport
{
...
}
With mappings:
<class name="BasicReport" table="reports">
<id name="Id" column="id">...</id>
<!-- some common properties -->
</class>
<joined-subclass name="Sp...
I have a .war file for an application that normally runs fine in Jetty.
I'm trying to port the application to run in WebLogic, but at startup I'm getting these exceptions:
ERROR:Foo - Error in named query: findBar
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from Bar]
at org.hibernate.hql.as...
I'm using Hibernate 3.5.1, which comes with EHCache 1.5 bundled.
If I want to use the latest EHCache release (2.0.1), is it just a matter of removing the ehcache-1.5.jar from my project, and replacing with ehcache-core-2.0.1.jar? Any issues to be aware of?
Also - is a cache "region" in the Hibernate mapping file that same as a cache "...
hey
i have the following domain model:
class Location {
String name
static hasMany = [locations:Location, persons:Person]
}
class Person {
String name
}
so basically each location can hold a bunch of people + "sub-locations".
what is the best way to recursively query for all persons under a location (including it's sub l...
I am trying to execute the following JPA query:
public static final String UPDATE_INVENTORY_CUSTOMER_FOR_AMS_MAPPING = "UPDATE Inventory inventory SET"
+ " inventory.customer.id = :" + DataAccessConstants.PARAM_CUSTOMER_ID
+ " ,inventory.lastUpdateUserId = :" + DataAccessConstants.PARAM_USER_ID
+ " where inventory.amsCo...
I am writing a web service to be deployed on Tomcat using Axis2. I am using Hibernate3 to persist data between the web service and a MySQL database.
When running the application through by IDE, the method I am exposing through Axis2 works as intended, however when I deploy the .aar to Tomcat, I receive a SOAP Error claiming that hiberna...
Hi all
I am currently using netbeans for a project. I have created my db using MySQL Workbench.
I have two relationships that are one to one. However once I create the POJOs using netbeans hibernate mapping files tools they are being created as one to many. I have tried reversing the db within workbench and the relationships are shown...
All,
i have a problem with hibernate using netbean platform 6.8, i have been search around internet, but cannot found the suitable answer
This is my story.
i am using oracle database as data source of my hibernate entity with ojdbc14.jar driver.
First i create hibernate entity tobe wrapped latter in a netbeans module, i tested the h...
I'm looking at a database dump file, and I see many records in various tables with their version number set in values other than 0 (even 94 in one case). I understand it has to do with hibernate locking strategy, but my concern is that today is Sunday, and the site has almost no visitors so is: is this normal ? Or is there a known hibern...
HI All,
I am new to hibernate and I would to create POJO from xxx.hbm.xml file.
Is it possible? Please respond
Regards,
Vikram A. Deshpande
...
Hi,
i'm facing problems executing a hibernate-search query. Every time when I search for a term that is contained in the lucene-index, the following exception is thrown:
Caused by org.hibernate.search.SearchException with message: "No Lucene configuration set up for: de.gridworks.everein.model.Membership"
org.hibernate.search.engi...
Hello,
I need to use a native sql query in Hibernate with use of variable.
But hibernate throws an error saying: Space is not allowed after parameter prefix
So there is a conflict with the := mysql variable assignment and hibernate variable assignment.
Here is my sql query:
SET @rank:=0;
UPDATE Rank SET rank_Level=@rank:=@rank+1 O...