I'm getting LazyInitializationException with session scoped bean in my service layer. If I load the same bean using a regular dao in my method, I can access it's lazy collections without problems. But if I inject it in my service bean, and then try to access one of its lazy collection, I have a LazyInitializationException.
I'm using J...
Hello,
I am developing Web Base Application using Spring, Struts2, Hibernate.
Now i am in the reporting phase of my system.
But i am little bit confused that which tool to use & which not.
I had tried Jasper report with struts2 plugin, but facing lots of problem in jrxml file.
Now can anyone suggest which reporting tool will be bett...
Consider the following JPA entity. My application instance class must always have a OneToOne reference to 4 special instances of Envelope but it also has a set of 0-infinite user defined envelopes. Is this even possible? Is it possible with both Unidirectional and/or Bidirectional references?
@Entity(name = "Application_Instance"...
I've got classes with mappings like this:
@Entity
public class CurrencyTable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Version
@Column(nullable=false)
private Timestamp version;
@Column(length=32, unique=true)
private String refCode;
@OneToMany(mappedBy="currencyTab...
Hi
I have a working HQL query which I want to optimize. It is as follows:
select distinct A.id from Import as A, Place D
where (A.place=D or A.placeBOK=D) and D.country=?
I tried to replcae the query from above by the following:
select distinct A.id from Import as A
where A.place.country=? or A.placeBOK.country=?
Besides performan...
Hello,
Having been googling for hours, I realize that users can use either xml file(orm.xml, I suppose?) or annotations in JPA, or both of them at the same time. I'm i correct?
So, My project use the second-level cache, which is not in the JPA specification. And I use annotations like:
@org.hibernate.annotations.Cache(usage =
org.hibern...
We have a Hibernate based system with Annotations.
Our entities have a custom property DELETED.
We have to select non deleted entities with non deleted sub-entities.
How can we can do it?
Little sample for describe the situation:
GenericEntity {
...
@Basic
@Column(name = DELETED)
protected Boolean deleted = false;
@...
I have a class that looks like the following:
public class MyClass {
private String dPart1;
public String getDPart1() {
return dPart1;
}
public void setDPart1(String dPart1) {
this.dPart1 = dPart1;
}
}
My hibernate mapping file maps the property as follows:
<property name="dPart1" not-null="true"/>
I...
@Entity
public class TestClass implements Serializable{
private Integer id;
private Set<String> mySet;
@Id
@GeneratedValue
public Integer getId() {
return id;
}
@OneToMany(cascade={CascadeType.ALL})
public Set<String> getMySet() {
return mySet;
}
}
I get the following error.
Caused by: or...
I have a method that takes a list of entities (Classes) and does some computation. To describe my needs here is the simplest outline of the method (pseudo-code):
public void do(List<Class<?> entities) {
for (Class<?> entity : entities) {
List<?> list = session.createCriteria(entity).list();
for (Object o : list) {
Sy...
When I include hibernate-c3p0 in my Maven's pom.xml file, I get a runtime NoClassDefFoundError as it can't find org.slf4j.impl.StaticLoggerBinder. It was my impression that Maven would resolve this dependency – so if c3p0 requires slf4j, then slf4j would be downloaded and included.
My pom.xml file has:
<dependency>
<groupId>org.hiber...
I am developing an application in struts 2 hibernate 3.
I have 3 tables
Inspection
InspectionMission
Timeline
Inspection is associated with InspectionMission and InspectionMission is associated with Timeline.
Now I have following problem. I have written following query in HQL
public List getQuartewiseInspectionList(){
Session ses...
Hello everybody,
i'm using hibernate schema export tool. As I'm using MySql as RDBMS provider, i wonder if i can place specific mysql parameters somewhere ,like using collation utf8_bin ...
Thanks
...
I'm using JPA (Hibernate implementation) to save objects to the database. Selecting works fine, but for some reason, saving doesn't work. I don't get any errors, but the database doesn't get changed either. This goes for both new entities and existing ones.
EPayment pay = new EPayment();
pay.setAmount(payment.getAmount());
...
pay.s...
I have a database view thar yields a result set that has no true primary key. I want to use Hibernate/Persistence to map this result set onto Java objects. Of course, because there is no PK, I cannot decorate any field with @Id.
When deploying, Hibernate complains about the missing @Id. How can I work around this?
...
I want to develop mysql database application using dbexpress to develop from scratch or work with existing databases. To create reusable layers what patterns-components should I use. I want the app to be scalable to n-tier easily. Tried google search for ready frameworks but I found nothing much informative (some lack documentation, some...
We are interviewing new developers looking for someone with some hibernate experience. We are trying to put together a list of questions to test an interviewee’s hibernate knowledge. We’re basically using the test to verify that someone has a good grasp of how Hibernate works. Seems like these days people will list anything on their resu...
We've just recently started using Hibernate and are still getting used to the way it works.
On of the things we've seen is that even after all sessions are closed and references have gone out of scope, hibernate still seems to maintain the previously used database values in it's cache.
We have code that reads from a set of tables in mu...
I have a hibernate bean called Property which has a type and a value. If type is a certain class (EntityValue) then value is a link to BaseEntity. BaseEntity has a @OneToMany @CascadeType.ALL List properties.
In order to safely delete a BaseEntity I will need to make sure it's not part of an EntityValue in any other BaseEntityS. Even...
Are the extra J2EE libraries required to run Hibernate standalone Java applications, or is the standard SDK sufficient?
Thank you.
...