hibernate

Hibernate SessionFactory: how to configure JNDI in Tomcat?

that's how the session factory should be gotten: protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { } } Please provide a simple solution for Tomcat6 to be able to get Sessi...

Hibernate mapping, on a unmapped class

Hi, I' ve got 2 tables... Challenge and ChallengeYear, ChallengeYear is only to create a list of years in challenge. I only want to make Challenge an entity, containing a list of List years. Is this possible? I've looked in to @SecondaryTable together with @JoinColumn and @OneToMany, but neither of those can do the trick, or i am ove...

Transaction issue in java with hibernate - latest entries not pulled from database

Hi, I'm having what seems to be a transactional issue in my application. I'm using Java 1.6 and Hibernate 3.2.5. My application runs a monthly process where it creates billing entries for a every user in the database based on their monthly activity. These billing entries are then used to create Monthly Bill object. The process is: G...

Java framework "suggestion" for persisting the results from an Oracle 9i stored procedure using Apache Tomcat

I am developing a Java servlet which calls an Oracle stored procedure. The stored procedure is likely to "grow" over time, and I have concerns the amount of time taken to "display the results on a web page". While I am at the implementation stage, I would like some suggestions of a Persistence framework which will work on Apache Tomcat...

Hibernate not releasing data base connections

Following is the configuration details: <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9iDialect </prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.cache.provider_class"> org.hibernate.cache.OSCacheProvider </prop> <prop ...

Lazy loading of Blob properties of one class

Hello, I want to lazy load of @Lob properties. First ,i use javassist to instrument my class as described here http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html#performance-fetching-lazyproperties: Code: My class contains "summary" and "title" properties those are Lob and other properties. Code: public class ...

Is it possible to select data with max value for a column using Criteria in Hibernate?

Lets say I have the following mapping: <hibernate-mapping package="mypackage"> <class name="User" table="user"> <id name="id" column="id"> <generator class="native"></generator> </id> <property name="name" /> <property name="age" /> </class> </hibernate-mapping> Is it possible to select the oldest user (that i...

HQL updates and domain objects

I have what may be a pretty elementary Hibernate question. Do HQL (and/or Criteria) update queries cause updates to live domain objects? And do they automatically flush now-invalid domain objects from the first-level cache? Example: Player playerReference1 = session.get(Player.class,1); session.createQuery("update players set gold = ...

Is there any advantage for using a library other than Hibernate for JPA?

Hi, I've been using JPA for some time now and been in projects where we've used both Hibernate Annotations and Toplink Essentials. AFAIK the project leader chose Toplink because Netbeans had it integrated and seemed to be the easy thing to do. However when looking for help, most of the literature seemed to assume that you are using Hi...

How to update a table with composite key using hibernate?

I am newbie to hibernate. If there is a table which has a composite key, how to update the table using hibernate. ...

Hibernate query: positioned parameter and named parameter

There are two types of query parameters binding in the Hibernate Query. One is positioned parameter and another one is named parameter. Can I use these two parameters in one Query? ...

Mapping a property to a field from another table in NHibernate

consider the following class: class Order { int OrderId {get; set;} int CustomerId {get; set;} string CustomerName {get; set;} //other fields go here } which is mapped to Orders table. Is it possible to map the property CustomerName to the Customers table through the foreign key relation? ...

How to I create an HQL query to return objects in a many to many relationship?

Hi there. I have an application that includes 2 classes Club and Article. These are mapped in Hibernate as a many to many relationship. As a result, hibernate has created a table called CLUB_ARTICLE which it uses to manage the many to many relation ship. The CLUB and ARTILCE tables have no direct reference to each other and the mapping ...

How to recover data from a table, and store that into list?

How can I get ALL the data from a table of my DB (mySQL) using hibernate, and store the output into List of Objects? I'll use this List, to populate a JTable. ...

HQL recursion, how do I do this?

Hi guys, I have a tree structure where each Node has a parent and a Set<Node> children. Each Node has a String title, and I want to make a query where I select Set<String> titles, being the title of this node and of all parent nodes. How do I write this query? The query for a single title is this, but like I said, I'd like it expanded ...

hibernate - lazy init joined component

I used the mapping solution from this question to have a joined component. But it make hibernate trigger join query to obtain the component event i use fetch="select" in <join> Please tell me how can i make the joined component lazy init. Thank you ...

zk selecting combobox item programatically

Hi, I cannot set the value of combobox programatically can some one tell me what missing in the code public class Profile extends Window implements AfterCompose { @Override public void afterCompose() { Session session = Sessions.getCurrent(false); ApplicationContext ctx = WebApplicationContextUtils.getR...

Passing empty list as parameter to JPA query throws error

If I pass an empty list into a JPA query, I get an error. For example: List<Municipality> municipalities = myDao.findAll(); // returns empty list em.createQuery("SELECT p FROM Profile p JOIN p.municipality m WHERE m IN (:municipalities)") .setParameter("municipalities", municipalities) .getResultList(); Because the list is em...

Hibernate "JOIN ... ON"?

I have an application that uses Hibernate for its domain objects. One part of the app is common between a few apps, and it has no knowledge of the other systems. In order to handle relations, our class looks like this: @Entity public class SystemEvent { @Id @GeneratedValue public int entity_id; @Column(name="event_type") ...

How to solve "NullPointerException" with "Server.processing" error while we are using Flex Builder 3 and BlazeDS?

I am using Flex builder 3, BlazeDS, and Java with Spring and Hibernate framework. I using the remote object to load a string from spring's configuration files. But in testing, I found this fault event like this: RPC Fault faultString="java.lang.NullPointerException" faultCode="Server.Processing" faultDetail="null" I have chec...