hibernate

Hibernate doesn't notice database updates made from other source

I have a small system consisting of a .net client and a java web service. The .net client inserts an object into the database, and then calls the web service. The web service tries to retrieve this object using hibernate. First time it works fine, but every other time it says that there is no object with the given identifier. I have ch...

save or update problem

We have an application which has a swing client and java app on the server (jboss.4.2.1.GA) side. We are using ejb3. In our application at some point we are successfuly creating an invoice and show it to the user but when user wants to chage the invoice we get the following error. After reloading the invoice user can be able to change t...

Hibernate ManyToOne relation to a joined subclass type

I have the following structure: [Class] public class SuperClass { } [JoinedSubclass] public class SubClass : SuperClass { } [Class] public class ContainerClass { [ManyToOne] public SuperClass SomeProperty {get; set;} } However, when retrieving an instance of ContainerClass via Hibernate.ISession.Get, it always returns me an ...

How can I configure Hibernate to use SSL to talk to the DB server?

I have an existing java webapp that uses Hibernate for it's persistence. I've been told that I have to have to talk to the DB encrypted - so my first thought is to set it up to do the communication via SSL - and went through figured out how to set up Oracle to listen for JDBC over SSL - http://www.oracle.com/technology/tech/java/sqlj_...

Hibernate Oracle Tablespace Annotation

I'm annotating my DAOs and using hibernate3:hbm2ddl to generate the ddls. Is there a way to annotate the tablespace? ...

JPA/Hibernate: Can I have a Parent without annotations and a Child with

I have a requirement to create a component which can be used stand-alone or within a larger application. When used stand-alone, it should not require a database, nor any database/ORM related dependencies. When used as as part of a larger app, some of the classes will indeed be persisted to a database via JPA/Hibernate. I was thinking ...

Hibernate @OneToMany - mapping to multiple join tables

Consider the following domain model: Issue - id - List<Comment> Entry - id - List<Comment> Comment -id -comment In my design, I was attempting to create two join tables to manage the associations; issue_comments, and entry_comments. I assumed @OneToMany on Issue & Entry, but how do you map the multiple join tables? Using hibernate ...

Hibernate WrongClassException / Sets / Discriminators?

Hi, The problem looks like this: A Product table. 3 joined-subclasses: DVD, CD, Book. A Role table (composite id: NAME, ROLE, PRODUCT), and subclasses by discriminator column ROLE: actor, director, artist, author, etc.. which are mapped to Actor, Director, Artist, Author java classes; (pretty usual I guess) ... A Book has authors, a C...

Oracle hibernate sequence generator problem

Hello friends, I am developing an application using oracle 11g, Java(struts2) and Hibernate. I have table named mytemp with column mytemp_id which is of type NUMBER(22,0). In my mytemp.hbm.xml file id is as given below <id name="mytempId" type="big_decimal"> <column name="MYTEMP_ID" precision="22" scale="0" /> <genera...

Shound I avoid using mappedBy to keep my application stable?

Hi! I have two entities like the following: @Entity public class Trip { @OneToMany(mappedBy = "trip", fetch = FetchType.LAZY) private Set<Job> jobs = new HashSet<Job>(); } @Entity public class Job { @ManyToOne(fetch = FetchType.LAZY) private Trip trip; } The problem is that the mappedBy relationship behaves diffe...

How can I double-enhance a class with cglib?

Hi there! Here's the code: Patient patient = factory.createPatient(); Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(patient.getClass()); enhancer.setCallback(new DefaultMethodInterceptor(patient)); patient = (Patient) enhancer.create(); assertThat(patient.getFirstName()).isNotNull(); ...

Table Name Troubles With Hibernate Named Query

Hi all, I've got the following named query in Hibernate: <sql-query name="CreateLogTable"> CREATE TABLE IF NOT EXISTS :tableName ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `url` VARCHAR (750) NOT NULL, `query` VARCHAR (500), `ipaddress` VARCHAR (39), `datetime` DATETIME NOT NULL, `hits` MEDIUMINT UNSIGN...

Does Hibernate's Criteria API still not support nested relations

I'd like to use Hibernate's Criteria API for precisely what everybody says is probably its most likely use case, applying complex search criteria. Problem is, the table that I want to query against is not composed entirely of primitive values, but partially from other objects, and I need to query against those object's id's. I found th...

Hibernate / DB2 -913 deadlock

An application deployed on several machines - accesses the same DB Table. It reads the MIN row and then deletes that row. When this happens concurrently, we get a -913 error from DB2 signifying deadlock. Have tried following options already 1. locks on row. 2. re-try mechanism in application code, after the deadlock occurs. Nothing se...

Text Field using Hibernate Annotation

I am having trouble setting the type of a String, it goes like public void setTextDesc(String textDesc) { this.textDesc = textDesc; } @Column(name="DESC") @Lob public String getTextDesc() { return textDesc; } and it didn't work, I checked the mysql schema and it remains varchar(255), I also tried, @Column(name="DESC", length="900...

Hibernate,Spring and Struts, No session bound to thread

Hi all, just a simple question about a great problem... In my web app i use Struts, Spring and Hibernate. I've a lot of Business (classes that edit the database with Hibernate), many action that interact with Business. In Spring configuration i've inject SessionFactory in Business and the Business into Actions. When I call a busines...

Which one should I learn? Spring+Hibernate or Java EE?

I've been doing some Java development, and have learnt my basics. I would like to take my skill to the next level by learning frameworks that are mainstream. I hear about Spring + Hibernate all the time. Lately, there has been some talk on Java EE with EJB 3 etc. I know there is a lot of war going on, but I'm looking for an answer. I k...

JPA fastest way to ignore a field during persistence?

I'm essentially looking for a "@Ignore" type annotation with which I can stop a particular field from being persisted. How can this be achieved? ...

oracle10g hibernate problem

when my app startup, i get error like below, can anyone elaborate what i missed out? the app running fine when using mysql. do i miss out any extra parameter in config.xml file? 2009-08-17 11:32:12,294 [main] INFO [info.jtrac.config.DataSourceFactoryBean] - Not using embedded HSQLDB or JNDI datasource, switching on Apache DBCP data sour...

How can we reduce the unnecessary loading of objects?

In hibernate as well as simple ORM strategy,i am normally loading all the values for the objects.Is there any way to avoid this. Due to this my app running slowly.. ...