We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

java oracle hibernate

gdv82
gdv82 asked
on
Medium Priority
2,011 Views
Last Modified: 2008-01-09

what is wrong with this method?

public void cleanLog(final Calendar from, final Calendar to)
    {
        getDao().getHibernateTemplate().execute(new HibernateCallback()
        {
            public Object doInHibernate(Session session) throws HibernateException
            {
                String hqlDeleteLog = "update EW_sub_TRANSACTION set EW_SUB_TRANSACTION.TRANSACTION_DETAILS = empty_clob() where ew_sub_transaction.EW_TRANSACTION_ID in ( select ew_transaction.EW_TRANSACTION_ID from ew_transaction where ew_transaction.TRANSACTION_DATE between :fromDate and :toDate)";

                session.createQuery(hqlDeleteLog).setCalendar("fromDate", from).setCalendar(
                        "toDate", to).executeUpdate();

                return null;
            }
        }, true);
    }

query works fine while using it in oracle but in this method it is throwing exception. Moreover when I am writing just like
update EW_sub_TRANSACTION set EW_SUB_TRANSACTION.TRANSACTION_DETAILS = empty_clob()  it is working but not with the whole hqlDeleteLog.

I am getting an error like :


org.springframework.orm.hibernate3.HibernateQueryException: expecting EQ, found '.' near line 1, column 49 [update EW_sub_TRANSACTION set EW_SUB_TRANSACTION.TRANSACTION_DETAILS = empty_clob() where ew_sub_transaction.EW_TRANSACTION_ID in ( select ew_transaction.EW_TRANSACTION_ID from ew_transaction where ew_transaction.TRANSACTION_DATE between :fromDate and :toDate)]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: expecting EQ, found '.' near line 1, column 49 [update EW_sub_TRANSACTION ...................
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004

Commented:
is:

    String hqlDeleteLog = "update EW_sub_TRANSACTION set TRANSACTION_DETAILS = empty_clob() where EW_TRANSACTION_ID in ( select ew_transaction.EW_TRANSACTION_ID from ew_transaction where ew_transaction.TRANSACTION_DATE between :fromDate and :toDate)";


any better?

Author

Commented:

no . this gives me error like:
EW_sub_TRANSACTION is not mapped.
ew_transaction is not mapped.
Invalid path: 'ew_transaction.EW_TRANSACTION_ID'
.............................

Commented:
See better the uppercase/lowercase.
EW_sub_TRANSACTION
EW_SUB_TRANSACTION
ew_sub_transaction

Hope this could help you.
Bye, Giant.

Author

Commented:
I GOT THE SOLUTION. actually i wrote sql query table names and not the object names of xml so it was like sql query rather than hql. which was creating a prob.
thanks .
Commented:
PAQed with points refunded (500)

GranMod
Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.