[Hibernate] questions about query of join
Query: 1. from invItem c where c.regularDoc is null; ---no rows return, should be a large number of rows 2. from invItem c where c.regularDoc is not null; --- returned the correct rows, cast (InvDecalItem) to get the rows. 3. from invItem c left join c.regularDoc doc where doc is null; --- returned rows, but I got cast exception (I cast the row to (InvDecalItem) as well as (InvItem) type) when I want to get row information. 4. from invItem c left join c.regularDoc doc where doc is not null; --- returned rows, the same as 3. I think of using join, I want to know that how to cast the result rows? public abstract class AbstractRegularDoc{ private InvDecalItem decalNew; ... public InvDecalItem getDecalNew() { return decalNew; } public void setDecalNew(InvDecalItem decalNewParam) { if (decalNewParam != null) decalNewParam.setRegularDoc(this); } } public class InvDecalItem extends InvItem { private AbstractRegularDoc regularDoc; public AbstractRegularDoc getRegularDoc() { return regularDoc; } public void setRegularDoc(AbstractRegularDoc regulardocs) { if (this.regularDoc != null) this.regularDoc.setDecalNew(this); } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate] confirm 9450b97270917ddaf59faa6fb2a16df9d93669e3
Query: 1. from invItem c where c.regularDoc is null; ---no rows return, should be a large number of rows 2. from invItem c where c.regularDoc is not null; --- returned the correct rows, cast (InvDecalItem) to get the rows. 3. from invItem c left join c.regularDoc doc where doc is null; --- returned rows, but I got cast exception (I cast the row to (InvDecalItem) as well as (InvItem) type) when I want to get row information. 4. from invItem c left join c.regularDoc doc where doc is not null; --- returned rows, the same as 3. I think of using join, I want to know that how to cast the result rows? below are related definations and classes: public abstract class AbstractRegularDoc{ private InvDecalItem decalNew; ... public InvDecalItem getDecalNew() { return decalNew; } public void setDecalNew(InvDecalItem decalNewParam) { if (decalNewParam != null) decalNewParam.setRegularDoc(this); } } public class InvDecalItem extends InvItem { private AbstractRegularDoc regularDoc; public AbstractRegularDoc getRegularDoc() { return regularDoc; } public void setRegularDoc(AbstractRegularDoc regulardocs) { if (this.regularDoc != null) this.regularDoc.setDecalNew(this); } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel