hibernate

Foreign key not stored in child entity (one-to-many)

Hi, I'm quite new to hibernate and have stumbled on this problem, which I can't find solution for. When persisting parent object (with one-to-many relationship with child), the foreign-key to this parent is not stored in child's table. My classes: Parent.java @javax.persistence.Table(name = "PARENT") @Entity public class PARENT { p...

JPA Problems mapping relationships

Hello. I have a problem when I try to persist my model. An exception is thrown when creating the EntityManagerFactory: Blockquote javax.persistence.PersistenceException: [PersistenceUnit: ASD] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) ...

Hibernate Updating an existing entity with a new object

Hi, Assume I have an entity Foo in the DB. I am parsing some files and creating new Foo objects and would like to check if the parsed Foo object exists in the DB (using a unique attribute). If it exists already update it otherwise save as a new object. What is the best approach? Could I simply set the id and version in the new Foo ...

SessionFactory in Hibernate

Hi, I am using hibernate-2.1 and "net.sf.hibernate.SessionFactory" class in my spring project. Now I am switched to Spring 2.5.6.A, where they are using hibernate3 and I am not able to find out the "net.sf.hibernate" package in that. But I found SessionFactory class in the package "org.springframework.orm.toplink". Is both the class ...

Mapping @OneToOne with @Where clause

I am trying to map an entity as following @OneToOne(mappedBy = "localizedLabel") @JoinColumn(insertable = false, updatable = false) @WhereJoinTable(clause = "locale='en_US'") public Localization getEn_US() { return en_US; } I can assure that the data will return only one or null if the not found, but hibernate seems to ignore my @...

Can Hibernate be used as the JPA provider in Google App Engine

Can Hibernate 3.5.x be used as the JPA provider instead of the default provider in the latest version of Google App Engine (1.3.2) ...

How to configure MySQL connection properties with Spring, Hibernate 3.3 and c3p0?

I am currently in the process of upgrading an application from Hibernate 3.2 to Hibernate 3.3. I though I'd stick with the default connection pool (Hibernate changed its default from Commons DBCP to c3p0) as I don't have any good reason to choose a non-default pool. At least non but having used DBCP before. The upgrade went pretty much...

Pass sql Blob to the client side

Hi I want to display image to the client side , but the problem is my image is stored in database in Blob format . Can u help me? ...

Hibernate generate POJOs with Equals

We are using hibernate in a new project where we use the hibernate.reveng.xml to create our *.hbm.xml files and POJOs after that. We want to have equals methods in each of our POJOs. I found that you can use <meta attribute="use-in-equals">true</meta> in your hbm files to mark which properties to use in the equals. But this would mean e...

Hibernate: Found: float, expected: double precision

I have a problem with the mapping of Oracle Float double precision datatype to Java Double datatype. The hibernate schema validator seems to fail when the Java Double datatype is used. org.hibernate.HibernateException: Wrong column type in DB.TABLE for column amount. Found: float, expected: double precision The only way to avoid this ...

How to model a relationship that NHibernate (or Hibernate) doesn’t easily support

I have a situation in which the ideal relationship, I believe, would involve Value Object Inheritance. This is unfortunately not supported in NHibernate so any solution I come up with will be less than perfect. Let’s say that: “Item” entities have a “Location” that can be in one of multiple different formats. These formats are comp...

one to many mapping within the same table in Hibernate..

I have a table containing primary key and foreign key that references same table. How can I implement this mapping in hibernate... structure of tables is as follows.. Dept ( deptno pk, dname, location ) employee ( empid pk, ename, Manager Id Foregin key references Employee(empid), deptno Foregin key referen...

where is the best palce to count the lazy load property using JPA

Let's say we have a "Question" and "Answer" entity, @Entity public class Question extends IdEntity { @Lob private String content; @Transient private int answerTotal; @OneToMany(fetch = FetchType.LAZY) private List<Answer> answers = new ArrayList<Answer>(); ...... I need to tell how many answers for the...

How do i generate hubernate models for java dotCMS plugins

Hi I am trying to create a plugin for dotCMS. My plugin stores data in database. i defined hibernate mapping file and put in my plugin folder's conf dir and i have no idea how to hibernate generate models based my mapping definition. I am using hello world plugin's mapping file for mysql Any help or comment would be highly appreciated ...

JPA: persisting object, parent is ok but child not updated

Hello, I have my domain object, Client, I've got a form on my JSP that is pre-populated with its data, I can take in amended values, and persist the object. Client has an abstract entity called MarketResearch, which is then extended by one of three more concrete sub-classes. I have a form to pre-populate some MarketResearch data, but ...

Filling combobox from database by using hibernate in Java

Heyy; I am developing a small swing based application with hibernate in java. And I want fill combobox from database coloumn.How ı can do that ? And I don't know in where(under initComponents, buttonActionPerformd) ı need to do. For saving ı'am using jbutton and it's code is here : private void jButton1ActionPerformed(java.awt.event...

Problem retrieving Strings from varbinary columns using HIbernate and MySQL

Hello, Here's my scenario. I save a bunch of Strings containing asian characters in MySQL using Hibernate. These strings are written in varbinary columns. Everything works fine during the saving operation. The DB contains the correct values (sequence of bytes). If I query (again using Hibernate) for the Strings that I saved I get the co...

Killing Mysql processes staying in sleep command.

Hey I am connecting a MYSQL database through hibernate and i seem to have processes that are not being killed after they are finished in the session. I have called flush and close on each session but when i check the server the last processes are still there with a sleep command. This is a new problem which i am having and was not the ...

ColdFusion 9 ORM/Hibernate and Remoting

Why does my cfc method (when returning JSON format or called via remoting) return all related objects regardless of the lazy setting on the property? ...

Making serach on database and Listing results with Hibernate in Java

I am developing swing based application with hibernate in java . And ı want to make search on database , and listing result... Before ı used to JDBC and ResultSetTableModel , and my before code is here : try{ Class.forName("*****************").newInstance(); Connection baglan=(Connection) DriverManager.getConnection("*******...