Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些像这样的表:公司、设备、设备公司(公司和设备的多对多)、用户、设备用户(用户和设备的多对多)。我想从 userId 中选择设备、公司名称、compayaddress,那么我该如何使用 hibernate 呢?谢谢和最好的问候!
我不知道您的班级结构,但基本方法是:
select u.device.name, u.device.company.name, u.device.company.address from user u where u.id=:userId
考虑到您已经在类用户中映射了实体设备,在类设备中映射了实体公司。