hibernate

hibernate how to create createalias left join?

@Entity @Table(name = "BOOKTEST") @NamedQueries({@NamedQuery(name = "Booktest.findAll", query = "SELECT b FROM Booktest b"), @NamedQuery(name = "Booktest.findById", query = "SELECT b FROM Booktest b WHERE b.id = :id"), @NamedQuery(name = "Booktest.findByBookName", query = "SELECT b FROM Booktest b WHERE b.bookName = :bookName")}) public ...

How to access SessionFactory of Hibernate using JNDI in WEBLOGIC 9.2 server?

We are using Weblogoic9.2.3 & DB is Oracle10.2.0.3. How can we access Hibernate SessionFactory using JNDI? ...

Hibernate lazy initlaization exception

I am trying to create an application using spring mvc and hibenate.I have been seeing this exception "failed to lazily initialize a collection of role" for nearly two days now :(..The application runs fine if i eager load the collections.But i dont want it that way I tried implementing OpenSessionInViewFilter in web.xml but still the er...

Establisment 2 relationship from one table to one table in hibernate

I have 2 table one table is City Table ( int id, string name) and my another table is Distance table(int id,int cityId (FK city),int neighbourId(FK city)),and i want to use hibernate but i cant establish relationships of these table to Hibernate. Thanks for everything... ...

How to map an abstract class or interface in Hibernate HQL?

Imagine that I have a Debtor class. With Hibernate, I will define the class like that: @Entity @Table(name = "T_DEBTOR") public class Debtor { @Id @Column(name = "ID_DEBTOR") private String idDebtor; ... My DAO will then looks like: public class DebtorDaoImpl implements DebtorDao { @PersistenceContext privat...

hibernate session error

I use hibernate for persistence. when i call the method : Session s = getCurrentSession(); s.flush(); i geth the following message : [toString() unavailable - no suspended threads] and it just stops running after the s.flush() method. I'm using JBoss IDE 1.6 and the message is shown within the Variables window when debugging. do y...

Hibernate Mapping Two Tables to One Class

I need to map two tables to a single class, having trouble figuring this out. One table is ROOMS, the other is TRAINERS. The ROOMS table: OOC_UNIT_ID NUMBER(6,0) OOC_START_DT DATE OOC_START_TM DATE OOC_DT_MOD DATE OOC_USER_MOD VARCHAR2(30 BYTE) OOC_END_DT DATE OOC_END_TM ...

2 JPA entities on the same table.

Let's say I've a table with 200 columns and most of them are never used. I map SmallEntity to the 10 columns that are used often. I use it in the associations with other entities. It loads fast, consume few memory and makes me happy. But sometimes I need to display the 200 columns. I'd like to map the BigEntity class on the 200 columns...

On-demand eager loading

Hi guys, I make a query: String query = "SELECT DISTINCT a FROM A a FETCH ALL PROPERTIES " + "JOIN a.Bs AS b " + "JOIN b.Cs AS c WHERE c = :c"; Query q = DAO.getSession().createQuery(query); q.setParameter("c", c); return q.list(); Even though I've said FETCH ALL PROPERTIES on a, when I access all the collections that A has...

Problem with mapping tag in hibernate configuration file

I am using hibernate annotations and when I do following everything works fine sessionFactory = new AnnotationConfiguration() .addPackage("istreamcloudframework.objectmodel.member") .addAnnotatedClass(User.class) .buildSessionFactory(); but I wanted to avoid specifyin...

hibernate many-to-many

Hi, i have three tables and 2 JPA model classes: Unit ------------ id [PK] - Integer code - String unitGroups - List<UnitGroup> UnitGroup ------------ id [PK] - Integer ugKey - String units - List<Unit> units and unitGroups have many-to-many relationship between themselves. briefly i want to write an HQL query...

Is there a way to define reusable properties to n-hibernate mappings?

I have a scenario that i want to add some standard properties to my entities. Meaning that i will have e.g. 1 int and 2 string properties applied to all relevant entities. I have over 100 mapping files and most but not all will be hosts to these new properties. In the classes its easy to define this; in the mappings however i've found no...

hibernate event detecter

I have a DB running on Oracle. I use Hibernate for data access. I want to be notified whenever an object is saved in the DB, so that I can do some custom work. I want an "event listener" if you could call it that. Is there a way to detect such task ? ...

Flex Java BlazeDS Dashboard - use Spring/JDBC or Hibernate ?

Hi, I am developing a IT Monitoring Dashboard for the company I work at. The system will primarily perform monitoring of files, databases and servers. There will be a small part of the system which will allow the users to configure static data about the system eg: file locations, server names etc... So as the app. will be a dashboard a ...

oracle where in limitation to 1000 / hibernate

Oracle knows the limitation to 1000 elements in the where a in (..) clause. Does this limitation also exist when using Hibernate in conjuction with Oracle? ...

Exclude entity bean attributes from hibernate query?

I'm new to this hibernate/jpa stuff so bear with me.. I've generated an entity bean and it works fine, but I would like to add some extra attributes to it and this causes hibernate to complain that the extra attributes aren't in the table's field list.. Is there a keyword to exclude these attributes from hibernate's query?? ...

order by length of certain property in Hibernate Criteria

Hi, I want to write a hibernate criteria to do the same job as normal sql statement like this: select * from XXX where XXX order by length(name) desc. Whats the best way to do this and how can I do? Thanks in advance! ...

tricky hibernate criteria

Hi, I have a sql statement which I want to move it into hibernate criteria, but I am not clue how to do this. The problem is one of the WHERE clause which looks like the following ...(skip other parts)... ? ILIKE strprefix||'%' ...(continue) strprefix is the column name, the ? is the place i need to fill in the value. With criteria...

Cast function for Hibernate

Hi, all I have tried to cast to float numbers from string in the database fields to compare with another numbers. The field in the database was String type. I have tried to use BETWEEN criteria using cast() as " cast(field, float) BETWEEN 1.003 AND 100.00)" in the where statement. however, it does not help. however, when I tried to ex...

Websphere Application Server Data Source

We are facing a strange problem with Websphere Application Server Data Source. Environment: Websphere Application Server (6.1) Linux Liferay Portal (5.2) Oracle 9i Hibernate 3.0 We have datasource deployed in Application server referencing ODBC14.jar Hibernate Configuration for Datasource: <property name="connection.datasource">jd...