I have a question about hibernate.
I want to save a small graph of detached objects :
session.save(new City(1));
Peron p = new Person(new City(1), new Street(2));
session.save(p);
Hibernate told me that city is transient but I do :
session.refresh(city);
session.refresh(street);
session.update(p);
Any Idea?
...
Hello,
I have a web app that gathers some data from the user and saves them to a mysql database. The problem is that for a String like "Ajánlat kiküldése", what gets stored to the database is "Ajánlat kiküldése".
For my database, i have DEFAULT CHARACTER SET utf8. For my tables i have DEFAULT CHARSET=utf8.
In my hibernate.cfg.xml i...
Hi guys,
I'm working on a program that parses data from a file and stores it into a HSQLDB database. As the parser encounters data it creates entities which are mapped to the database using JPA/Hibernate. My problem is that while the parsing is being performed the application uses more and more memory. I have successfully used cached ta...
hi everyone, i have a problem with generating entity classes in netbeans. i'm certainly doing something wrong since i am beginner with j2ee. i have my derby database with some tables in it and i want to make entity class from one of those tables. unfortunately i get an error which says "Index:0, Size:0" after clicking on finish in the wi...
Can anyone suggest the correct syntax for a where clause using in
applied to a list? The following query in an .hbm file generates a parse
exception:
<query name="Nutrient.findNutrients1">
<![CDATA[from Nutrient as nutrient where nutrient.id in elements(?)]]>
</query>
The exception follows:
PARSER.reportError(56) | line 2:95:
...
Caused by:
org.hibernate.MappingException: Could not determine type for: controler.Role, for columns: [org.hibernate.mapping.Column(ROLE)]
Can you please help me on this?
this is my mapping class
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hiberna...
Hello,
i want to use hibernate to get record from db, such that it's with the max dbId, i tried to use projections, creating alias for 'max(dbId)', then using it in 'restrictions.eq', but it keeps telling me invalid number, i think this may be because it's an integer in db, and i mapped it as a string in my entity,
could any one help m...
LinkedIn provides a mechanism to say that the user was part of a search criteria "n" number of times in the last "x" days. How do you go about capturing and storing the information. Are you supposed to iterate the search results and put an appropriate counter whenever they get searched or is there a non-intrusive mechanism by which this ...
Hi,
new to hibernate.
I have a problem that when i am trying to run select query say
"from Foo where Foo.some_id=2"
(with hibernate template) then hibernate is also tries to insert the records in a table 'Foo2' that has a one-2-one association with the Foo table
Bean Foo
class Foo{
int id;
....
Foo2 foo2;
}
Foo.hbm.xml
...
<one...
Is there a way to do eager evaluations with a join table?
Let's say you have table foo, table bar, and table jbf.
Table jbf is the table that joins foo and bar with a many to many relationship.
foo needs to populate it's bar member using this table.
For reasons I won't go into I can't use hql and I don't want to make the getter for bar...
I am having trouble working out how to do a bulk delete of a Person object using JPA, when the Person objects contain data stored using an @ElementCollection. Any ideas on how to do this would be much appreciated.
@Entity
@Table(name="at_person")
public class Person implements Comparable<Person> {
@Id
@GeneratedValue(strategy =...
Hi,
Can anyone tell me what is the difference between JTA, JPA, and Plain JDBC in terms of hibernate? I have been asked continuously this question and I fumble while giving the answer.
Best Regards,
Aashutosh
...
I've got a many-to-many relationship in my database and I'm using Hibernate to retrieve a single row from the left hand side of the relationship. I then just call the getter method to retrieve the associated right hand side of the relationship (lazy fetch).
As part of my work, I need to sort the right hand side "list" object by doing...
Hi all,
when loading lots of objects, I get a OOM-Exception. After analyzing the heap with a profiler, I see that there's a lot of memory in org/hibernate/util/IdentityMap which references a LinkedHashMap containing thousands of Entrys. What are those objects used for?
I'm really thankful for all kinds of information...
...
Java bean Format:
public class Format extends HibernateBean implements Serializable {
private static final Logger log = Logger.getLogger(Format.class);
private Long id;
private boolean isQualifyFormat;
...other fields
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
**//stati...
Hi all,
In my hibernate config show_sql property is 'true' and since i am not using log4j API of logging, by default hibernate was showing queries with '?' marks in the tomcat console.
In my case i need to print the complete sql query with parameter values which was executed by hibernate into logs, but i am not using log4j API for logg...
I tried without succes to make a custom type mapping between DateTime joda and DATE db2.
Which annotations should we use in the case of using joda time hibernate library instead of custom type mapping ?
Thanks a lot
...
Hello!
I am a newbie with Maven2 and I write a pom.xml.
Now I want to get Hibernate and javax.persistence to resolve this:
import javax.persistence.Entity;
...
import org.hibernate.annotations.Fetch;
...
What needed to be done? I wrote in my pom.xml:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifa...
Greetings,
I have a setup which must be fairly common: I have an H2 db, with a db file. I'm using the db in standalone mode. Hibernate provides access to db, and I've deployed my code into Tomcat.
The problem is: I could not find a nice way of simply putting the db file into the war, and providing a relative path in hibernate config fil...
hi
am new and hibernate is driving me crazy full time.
i hv 2 tables one-2-one mapping. when i join only these 2 these two then hibernate is not mapping and when i join table1 with some other table3 then its giving me fine mapped results.
Bean1
private int id ;
private BlessUser blessUser ;
private SnsAuthenticator snsAuth ;
public vo...