-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: DB2390Dialect: alias to long
PostPosted: Fri Jan 13, 2006 3:21 am 
Newbie

Joined: Fri Jan 13, 2006 3:04 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.