hibernate

How to move the environment details outside the EAR

Hi All, Our project is a medium size web application developed using RAD 7.0 on WAS 6.1/hibernate/struts which moved to production. Currently we have hardcoded the ip address of the production system in the property file and database schema details in the hibernate config file. Our client wants us to come up with the solution for keep...

Hibernate and IDs

Is it possible in hibernate to have an entity where some IDs are assigned and some are generated? For instance: Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database. ...

Best strategy to multiple CRUD with jsf

Hi, on my company we are developing a ERP-like app using java and jsf, so far the design team has identified about 20 entities,each with diferent properties, usually we'll be building 20 pages of CRUD , is there any better way to do this?, we are using hibernate as db access, so we came up with the idea of a single DAO for this part of t...

Hibernate ID Generator

Anyone know of some good tutorials on how to create a custom ID generator for hibernate? ...

How easy is it to set up JBoss Seam to run on GlassFish with JPA instead of Hibernate?

Question pretty much says it all - I'm interested to find out about how to set up JBoss Seam on a GlassFish (v3 prelude) application server rather than JBoss. Also, I prefer JPA over Hibernate for persistance but it looks as though Seam has dependencies on Hibernate (or at least parts of it), has anyone got any experience with a stack li...

Hibernate change fetch mode in runtime

Hi there. I have two tables related together using one-to-many relation : employee -> department : and relation through department_id in the employee table. I use hibernate : and my hibernate mapping files are: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" ...

Difference between Set and Collection in hibernate

What is the difference between using a Set or a Collection for @OneToMany or @ManyToMany properties on my hibernate entity objects? Does Hibernate map things differently depending on which one you choose? ...

How can I query a SQL 2005 XML field with NHibernate?

My Microsoft SQL Server 2005 database contains a table that has an XML field that has some important metadata, and under normal SQL I could run the following query and get a list of items which don't have UPC codes set... Unfortunately I'm having a hard time re-creating this query using NHibernate's Criteria API: SELECT [Id],[meta].valu...

Mapping a bidirectional list with Hibernate

I don't understand the behavior of Hibernate when mapping a bidirectional list. The SQL statements that Hibernate produces seem not optimal to me. Can somebody enlighten me? The scenario is the following: I have a one-to-many parent-child relationship. I map this relationship with a bidirectional list. According to the Hibernate Annota...

Hibernate One-To-Many Unidirectional on an existing DB

Hello Stack Overflow Experts, i have need of your expertice: I am trying to use Hibernate on an Existing DB. Currently im trying to load a User object and a list of UserData objects that go along. in the DB the (simplified) layout is | User | | UserData | ---------------- ----------------------...

JPA/Hibernate store date in UTC time zone

How can I configure JPA/Hibernate to store a date/time in the database as UTC (GMT) time zone? Consider this annotated JPA entity: public class Event { @Id public int id; @Temporal(TemporalType.TIMESTAMP) public java.util.Date date; } If the date is 2008-Feb-03 9:30am Pacific Standard Time (PST), then I want the UTC t...

HQL string matching on complete words?

How do I match complete words in a hibernate HQL query? For example, imagine in our database we have an entry "Sam Adams". Now, given this HQL fragment: book.character like 'Sam' I do not match on "Sam Adams". However, if I change my query to: book.character = 'Sam%' then I also match on "Samantha". But, I don't want that to mat...

hibernate 3 + oracle 9 clob type to string convert using Jsf -- how to

As the title says it all -- I need to save a large text from jsf UI into a 'clob' type column in Oracle 9i. I use Hibernate 3.3. I've referred many sites, but no help. So far tried, this and setup a user defined type like this. Also setup a clob converter. I think I'm something fundamental. Can anyone please point out to a correct articl...

Optimize Hibernate entities saving?

Hi Is there a way to reduce unnecessary/empty fields in SQL inserts and SQL updates? For example, I have a single hibernate entity class mapped to a table that has 10 columns. The populating of data is actually done in two phases. When the user submit a request, I will insert the request information into the table with the hibernate ent...

Exchanging of screens between two users

We have a web-based application with tech stack - 1. Java Struts based 2. Hibernate 3. DB - Oracle 4. App server - JBoss server We are facing an issue related to concurrent usage of the application by two or more users. When I am doing an operation and I submit the changes, the next page or success message that comes up is of a differen...

How do I use the current date in an HQL query with an Oracle database?

I'm trying to write this query using Hibernate 3 and Oracle 10. from Alert alert where alert.expiration > current_date() order by alert.priority, alert.updated, alert.name It's creating SQL like this - Hibernate: select alert0_.ANNOUNCEMENTS_ID as ANNOUNCE1_1_, alert0_.ANNOUNCEMENT S_NAME as ANNOUNCE2_1_, alert0_.ANNOUNCEMENTS_PRIO...

Getting column length from Hibernate mappings?

To validate data I am receiving I need to make sure that the length is not going to exceeded a database column length. Now all the length information is stored in the Hibernate mapping files, is there anyway to access this information programmatically? ...

Data handling in web app with GWT, Struts and Hibernate

I am writing a Web App using Struts and Hibernate. Recently, I discovered GWT and the Visualization API. This all looked very interesting and provides AJAX functionalities that my app needs. I'm a newbie that is quite confused.... Where to put data access level checks? In the web app, users have different level of access for the data. ...

How do I map a Map from an Entity to a Value with hibernate annotations?

I have Shipment and Product entities. Each shipment consists of any amount of any numbers of products. I.e. a shipment has a field named products which is a java.util.Map where they key is the product being shipped and the value is the number of instances of that product being shipped. How do I map that to a db with hibernate annotation...

Can you order hql results based on matching restrictions?

I have an object Dog which holds a set of DogMetadata. Each DogMetadata has two values: a String ("desc") and an int ("rank"). Descriptions of dogs have different rankings such as: "small" is 5, "furry" is 2, "friendly" is 9, "dalmation" is 11, "mutt" is 22. I need to search for dogs based on any of their desc values (for example, fin...