hibernate 的join fetch问题。。

比如我有个员工类User,1个地址类Address
[code="java"]
public class User{
int id;
Address add;
}

public class Address{
int id;
int userId;
}

[/code]
mapping中2者没有任何关联
我想问下能不能不配置mapping关系,直接用hql通过user的id查询user时把address同时查出来
这个是我自己写的个hql
[code="java"]
from User as user left join fetch user.acc as acc on user.id=acc.userId where user.id=1";
[/code]
不过有错误。。。希望哪位能指点下小弟

不对,不做映射怎么用hql啊?
sql:select * from user(表名) as user left join address(表名) as add on user.id(外键)=add.userid where user.id=1

[code="sql"]from User as user left join fetch user.acc as acc where user.id=acc.userId and user.id=1"; [/code]

抱歉没细看pojo,你试试这个
[code="sql"]
from User left join fetch Address where User.id=Address.userId and User.id=1";

[/code]

hql:from User user left join fetch user.add add where user.id=1

sql:select * from user(表名) as user left join address(表名) as add on user.addid(外键)=add.id where user.id=1

要么就写sql,要么就配映射,不配映射还想用hql,我看难。。。