hibernate

Which JAR contains org.springframework.orm.hibernate.HibernateTransactionManager?

Hi I am trying to use Hibernate+Spring in my application but stuck into following error: java.lang.ClassNotFoundException: org.springframework.orm.hibernate.HibernateTransactionManager Tired of googling, could any stackoverflower tell me which JAR contains the above class? EDIT An important thing that I did not notice was that Spri...

How to set up hibernate to use Glassfish connection pool?

I have set up a connection pool in Glassfish with a jndi resource for it also setup. I am stumped on how to configure hibernate to go get it. I have come across alot of write ups to configure it to use C3P0 connection pool. Well I am lost. I found that I need to set: hibernate.connection.datasource hibernate.jndi.url hibernate.jndi.c...

How to read Hibernate mapping

Hi, I need to know which physical column is associated to a persistent's attribute. e.g. Class LDocLine has this attribute private Integer lineNumber; which is mapped in hibernate like this : <property name="lineNumber" column="LINENUMBER" type="integer"/> The method I need is something like : getColumn("LDocLine","lineNu...

How do I use Criteria to make a join on a date field (in DB2) based on the year.

I have a java.util.Date field in my Object. I would like to use Criteria to select all rows that have a date field with a given year. The SQL would look like the following: SELECT * FROM GAME GM WHERE YEAR(GM.GAME_DATE) = 2010 How can I use Criteria to accomplish this? Thanks in advance. public Collection<Game> getGamesByDate(Date...

avoid duplication with auto increment key in Hibernate

I am trying to use Hibernate to auto increment the id, however, I try to avoid duplication. class Service { Long id; // auto increment String name; String owner; Boolean incremental; // setter and getter } What I want to achieve is, whenever the new service object I want to save has the same name and owner(no matter...

Why bind hibernate SessionFactory to a JNDI resource?

In my current adventure of learning hibernate and setting it up to use an appserver's connection pool, most examples and resources out there point you in the direction of binding the SessionFactory to a JNDI resource in your appserver in the process. I wondering what the benefit of this is? Since the you can access a the connection pool...

Dealing with schema upgrades while using Hibernate

I'm using Hibernate as the ORM for my application. I would like to know if there is a good solution to dealing with schema upgrades in my application when these upgrades are done by someone else. For example, I have a set of hbm.xml files and corresponding java classes generated using Hibernate tools. Now in production, everything works ...

I am getting an error with a oneToMany association when using annotations with gilead for hibernate through gwt

Hello Guys I'm using Gilead to persist my entities in my GWT project, im using hibernate annotations aswell. my problem is on my onetomany association.this is my User class that holds a reference to a list of FileLocations @Entity @Table(name = "yf_user_table") public class YFUser implements Serializable { @Id @GeneratedValue(strateg...

Spring-hibernate mapping problem

I have a spring-hibernate application which is failing to map an object properly: basically I have 2 domain objects, a Post and a User. The semantics are that every Post has 1 corresponding User. The Post domain object looks roughly as follows: class Post { private int pId; private String attribute; ... private User user; ...

How can I ask Hibernate to create an index on a foreign key (JoinColumn)?

Hi, This is my model. class User{ @CollectionOfElements @JoinTable(name = "user_type", joinColumns = @JoinColumn(name = "user_id")) @Column(name = "type", nullable = false) private List<String> types = new ArrayList<String>(); } You can imagin there would be a table called "user_type", which has two columns, one ...

Unable to create session object

hi, i used the code Session session = new Configuration().configure(cfgurl).buildSessionFactory().openSession() ; to create a session. the cfgurl is of type URL and points to the hibernate.cfg.xml file of another project. The problem is it is getting hanged and unable to proceed further. What is the problem? Help ...

grails console issue : No Hibernate Session bound to thread,

i'm trying to learn Grails console and had a problem. It looks like this: When I start grails console in my project WITHOUT starting the project, I can persist data to my postgreSQL database. However, when I started the project (after a bunch of error messages from netbeans output), I cannot do what I did anymore from Grails console. ...

How to make an entity out of a join table without primary key

I'm trying to generate JPA entities out of an existing database having an "interesting" design. Database has a table called UserSet, which can have links to several other UserSets. There is a one to many relation between UserSets and LinkedUserSets. LinkedUserSets also has one to one relation to UserSets. I tried to generate a JPA Enti...

Can I call a stored procedure with hibernate criteria?

This is my problem, I have to use a big SP, and there is no time to rewrite in java. So I'm using Hibernate criteria and I don't know if i can call it. Thanks to all. ...

Why don't Domain class static methods work from inside a grails "service"?

I want a grails service to be able to access Domain static methods, for queries, etc. For example, in a controller, I can call IncomingCall.count() to get the number of records in table "IncomingCall" but if I try to do this from inside a service, I get the error: org.springframework.beans.factory.BeanCreationException: Error creat...

Does @JoinTable has a property of "table" or not?

The following is copied from hibernate's document. (http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e2770) @CollectionOfElements @JoinTable( table=@Table(name="BoyFavoriteNumbers"), joinColumns = @JoinColumn(name="BoyId") ) @Column(name="favoriteNumber", nullable=fals...

Execute sybase stored proc from hibernate

I am having issues with executing a simple sybase stored proc from hibernate. The procedure takes some input and returns one record. I tried with the following tag in hibernate mappings file and java code. <hibernate-mapping> <sql-query name="sybaseproc" callable="true"> <return class="Myentity"> <return-property name="next" colu...

CF9 HQL Statement for many-to-many and Multiple Criteria

I have the following setup: Listing.cfc component persistent="true" { property name="ListingId" column="ListingId" type="numeric" ormtype="int" fieldtype="id" generator="identity"; ... property name="Features" type="array" hint="Array of features" singularname="Feature" fieldtype="many-to-many" cfc="Feature" linktable=...

Example for creating a configuration

hi, i am facing some difficulties in creating a session. Can anyone provide me an example or link where a configuration is created by using an external file by giving url,like Configuration config = new Configuration.configure(url); the config file is in another hibernate project. is there anything that i should add to classpath o...

Is there a way to get only the changed columns from an object using Hibernate?

In a persistent object, If i change only one field, Is it possible to find out the changed field only through Hibernate? I know I can get the entire old row and new row and compare. ...