?
Solved

java oracle hibernate

Posted on 2006-04-04
6
Medium Priority
?
1,913 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 ...................
0
Comment
Question by:gdv82
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 16370550
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?
0
 

Author Comment

by:gdv82
ID: 16370652

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

Expert Comment

by:Giant2
ID: 16370858
See better the uppercase/lowercase.
EW_sub_TRANSACTION
EW_SUB_TRANSACTION
ew_sub_transaction

Hope this could help you.
Bye, Giant.
0
 

Author Comment

by:gdv82
ID: 16371334
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 .
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16672882
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question