hibernate

I've written a java getting-started tutorial, where would be a good site to post it for checking?

Hi all, For our company's internal training, I'm writing a java getting-started tutorial. This will go all the way from installing eclipse through to writing a working demo application with Struts, Hibernate, Sitemesh, and Sql server. Now, admittedly i'm new to Java (although have good c# experience) - where would be a good site to pos...

EntityDelete ColdFusion EHCache

How do i delete an Hibernate Entity that is being cached by EHcache and by using Entitydelete in coldfusion? ...

Does HIBERNATE support the limit statement in MySql??

I am working on a project which uses Java,MySql,Struts2 MVC and Hibernate. I tried using limit statement in hql query but its not working properly. Select t from table1 t where t.column1 = :someVal limit 0,5 EDIT: I am using this as a namedQuery and calling this namedQuery using JPA Template This works correctly in MySql but when I r...

Hibernate JPA Template fetch

Hibernate JPA Template fetches list of objects from database. Can this be type casted to another class object list?? List<Class1> list1 = (List<Class1>) getJpaTemplate().findByNamedQuery("..someQuery.."); This is the code which i use now. Class1 relates to a table1 in database. Will I be able to fetch the records in table1 into anoth...

hibernate @GeneratedValue correct?

I set my entity property @GeneratedValue Long id; and I able to generate id for the entity in database. My question is why all the entities are sharing the same incremental number? aren't each table should start counting from zero? ...

Store Password Field in Encryption Form Using MySQL and Hibernate

I am using Spring, Hibernate for developing my application. And as DB side, I have MySQL. I have an User table and that has password field of varchar type. Now, when a new user is created, I just want store password field in an encrypted form. Is there any facility provided by Hibernate to do so? Or is there any other way? ...

Not so Strange error: Could not parse [..] hibernate.cfg.xml [..] Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

I am deploying my application to Tomcat 6.0.20. Application uses Hibernate as ORM, Spring, and JSF for web-tier. I also made simple runner from main() method to test Spring-Hibernate collaboration. And it does work fine and hibernate.cfg.xml is parsed pretty well. I can append some code or full stack trace but I'm not sure that it's n...

Hibernate Transaction question

Hi there, I'm using Hibernate with a JTAFactory - in my case: jBossJTA - I've configured my hibernate.xml with the current JTA, now maybe I'm doing something wrong, my dao code looks like this try{ ses = sessionFactory.getCurrentSession(); ses.beginTransaction(); doSomeWork... session.getTransaction().commit(); }catch(Exception...

Collection exploration in validator interceptor

Hi all. A question about Java-Hibernate-Validator. I need to access to a collection attribute when my validation system intercepts an entity insert/update. I mean, my model defines A class with a set of B elements. When I call saveOrUpdate(a), the onSave/onFushDirty method of my interceptor is invoked. In that moment I need to know the...

Searching object property in a predefined list using HQL

Hello, I'm trying to make a query in HQL that see if the id of a person is in a list of predefined ids. For example, I would like to find all persons that have id 1 or 2 in a database. The problem is that I cannot do: from Person person where id in elements(:ids) because elements expects an identifier (like person.childIds for example...

Is generator="increment" good enough for sequential invoice number?

I need to write a invoice generating software in ColdFusion 9 using ORM (Hibernate). One of the requirements is that the invoice number must be sequential without gap, which means no invoice number can be skipped. The database identity value (i.e. generator="native") does not work as it skips a number if transaction failed to commit. ...

ehcache warnning message " No configuration found"

I have got following warning when the application start up. 2009-05-13 09:19:41,171 WARN net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath:jar:file:/app/java/lib/ehcache-1.1.jar!/ehcache-failsafe.xml I found encache code in following url .. Configuration...

How can i wire-up org.springframework.transaction.interceptor.TransactionProxyFactoryBean and org.springframework.orm.hibernate3.HibernateInterceptor ?

I wired-up but it did not work as I expected. I have set the lazy inialization true between entities abd believe,HibernateInterceptor manages the hibernate session. When I trying to access the object properties, it thorws exception LazyInitializationException. Error messgae : Transaction could not initialize proxy - the owning Session ...

DWR/OpenSessionInView "Session is Closed!" in Java and Hibernate

They say that a closed session in hibernate and webapp with ajax is a common problem with java and spring so I have to set the OpenSessionInViewInFilter in the web.xml like this <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextCon...

@Range based hibernate validation checks

I would like to perform @Range based hibernate validation checks (org.hibernate.validator.RangeValidator) in my JPA entity code. But it seems to modify the generated SQL with this checks which I would like to avoid. (i.e In the range check, I have the current year as the @Range max value which is bound to change every year). Hence, I ha...

Preventing NaN from being persisted by Hibernate

I am using Hibernate as my JPA provider with it connecting to a Progress database. When a NaN value is persisted it is causing lots of problems - it prevents the row from being read in certain circumstances. Is there a way to hook in to the standard double type persistence to convert NaN (and probably + and - infinity) to a different val...

HibernateTransactionManager : possible to throw exception without rollback ?

In Spring, I have declared a method to be transactional. I use HibernateTransactionManager. Now, I would like to throw an exception from this method, but I do not want hibernate to rollback the transaction. Is it possible to specify wich exceptions cause the rollback ? ...

Criteria to HQL

Hi, is there any way to take a Criteria (that has multiple Criterias, Restrictions and Orders) and generate a HQL query out of it? Cheers Nik ...

Get Criteria by associationPath

Hi guys, Every so often, I get a "org.hibernate.QueryException: duplicate association path: myAssociation". This is because the complex criteria I'm working with can define the same path in many places. I'd love to do something like Criteria association = myCriteria.getAssociation("wax"); if(association == null) association = myCriteri...

Seqential & continuous invoice number in Hibernate / ColdFusion ORM?

One of the requirements of my billing software is that the invoice number must be sequential & continuous. (no invoice number can be skipped). I tried setting the invoice number as PK, and tried hibernate's increment & native generator, but both of them do not guarantee continuous number when a transaction fails. The next invoice will ...