spring - NamedEntityGraph Returns All Columns and Objects -
i trying utilize namedentitygraph limit return data specific queries. not want return full object details when listing object. simple class example below.
@entity @table(name="playerreport",schema="dbo") @namedentitygraphs({ @namedentitygraph(name = "report.simple", attributenodes = {@namedattributenode(value="intid") } ) }) public class playerreportentity { @id @column(name="intid",columndefinition="uniqueidentifier") private string intid; @column(name="plyid",columndefinition="uniqueidentifier") @basic(fetch=fetchtype.lazy) private string plyid; @manytoone(fetch=fetchtype.lazy) @joincolumn(name = "plyid", insertable=false,updatable=false) private playerentity player;
no matter plyid , player returned. there way return requested columns (intid) ?
as collection hibernate not join player object still returns player null. part working extent.
i using jparepository below generate crud statements me
public interface playerreportrepository extends jparepository<playerreportentity, string> { @entitygraph(value="report.simple") list<playerintelentity> findbyplyid(@param(value = "playerid") string playerid); @override @entitygraph(value="report.simple") public playerintelentity findone(string id);
}
a chunk of text here - "hence seems @namedentitygraph affects fields collections, fields not collection loaded." from jira
please use example 47 on this page , use repositories accordingly. in essence, hibernate right loading feilds in class , collections work if follow example stated above.
thanks.
Comments
Post a Comment