如何从第二个表中获取值,而不是在hibernate中加入

时间:2022-05-04 20:14:48

hi i have a table called CHECKPRODUCT.

嗨我有一张名为CHECKPRODUCT的桌子。

i also has 2nd table called CHECKSTATUS_LOOKUP with column name DESCRIPTION

我还有第二个名为CHECKSTATUS_LOOKUP的表,列名为DESCRIPTION

while i am getting values from CHECKPRODUCT, i also want value from DESCRIPTION column of 2nd table(CHECKSTATUS_LOOKUP) but i dont want ot join both tables. is there any ways to do that

虽然我从CHECKPRODUCT获取值,我也想从第二个表的描述列(CHECKSTATUS_LOOKUP)中获取值,但我不想加入两个表。有没有办法做到这一点

2 个解决方案

#1


Please give more details and explain what columns you have in the two tables and what exactly is the requirement.

请提供更多详细信息并说明您在两个表中的列以及具体要求。

You could use a subquery instead of a join in most cases.

在大多数情况下,您可以使用子查询而不是连接。

#2


Only an advise. When you are using Hibernate or NHibernate is better to talk about class+properties instead table+fields

只有一个建议。当你使用Hibernate或NHibernate时,最好谈论class + properties而不是table + fields

#1


Please give more details and explain what columns you have in the two tables and what exactly is the requirement.

请提供更多详细信息并说明您在两个表中的列以及具体要求。

You could use a subquery instead of a join in most cases.

在大多数情况下,您可以使用子查询而不是连接。

#2


Only an advise. When you are using Hibernate or NHibernate is better to talk about class+properties instead table+fields

只有一个建议。当你使用Hibernate或NHibernate时,最好谈论class + properties而不是table + fields