Hi friends!
I have three tables but they haven't any association(foreign key). I want to select some columns from them. I must use join(outer join or inner join).But hibernate report error if I use join.
for example:
Code:
Query q=session.createQuery("select a.name,b.age from A as a left outer join B b on b.company_id=a.apply_id");
createSQLQuery method also don't work!
select {s.ProjectCode} from pub_pro_status s
Code:
Query q=session.createSQLQuery("select a.USER_NAME as {user.name},b.USER_AGE as {user.age} from A as a left outer join B b on b.company_id=a.apply_id");
error message:
Code:
net.sf.hibernate.JDBCException: SQLException occurred
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3809)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at test.ReadWritePrintXML.exc(ReadWritePrintXML.java:123)
at test.ReadWritePrintXML.main(ReadWritePrintXML.java:58)
Caused by: java.sql.SQLException: ORA-00904: "USER_NAME_1_0_": identifier invalid
Can't I use join if two tables have not association?
If I want to use join how to do it? Thks!
[/code]