Hi,
I'm using hibernate version 3.1 and discovered a problem using the DB2390Dialect. Sometimes hibernate generates an alias which is longer than 18 characters in the select statements which is not allowed on DB2. I have solved the problem by making a class which extends the DB2390Dialect and overrides the method: int getMaxAliasLength(). I have set the length to 5.
I don't think this is the right solution. The dialect have to ensure that the alias is not longer than 18 characters and starts with a letter.
This is the code:
Code:
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.getCurrentSession();
Query query = session.createQuery("from Budget as budget where budget.produktId = :produktId").setParameter("produktId", new Long(engagementsEntry.getId()), Hibernate.LONG);
List budgetter = query.list();
I'm also getting the error using this code:
Code:
Criteria criteria = session.createCriteria(Budget.class);
criteria.add(Restrictions.eq("produktId", new Long(engagementsEntry.getId())));
List budgetter = criteria.list();
Best regards,
Paw