java - Select to constructor OneToMany relationship in QueryDsl -




i want select elements database using querydsl.

    final quserentity user = quserentity.userentity;     new jpaquery<userresponse>(em)                     .select(projections.constructor(user.class, user.id, user.name,                              projections.constructor(addressresponse.class, user.address.id, user.address.name),                              user.pets))                     .from(user).fetch(); 

i want use constructor in user:

public userresponse(final string id, final string name, final addressresponse address, set<pets> pets) {     this.id = id;     this.name = name;     this.address = address;     this.pets = pets; } 

the user , address works fine, don't know how handle pets, onetomany-entity , set of entities.

'pets' has following relation in user:

@onetomany(fetch = fetchtype.lazy) @joincolumn(name = 'petid', referencedcolumnname = 'petid') private set<pet> pets; 

however, when try run following error:

com.microsoft.sqlserver.jdbc.sqlserverexception: incorrect syntax near keyword 'as'. 

and generated sql has syntax error:

select   chargepoin0_.userid    col_0_0_,   chargepoin0_.username  col_1_0_,   chargepoin0_.addressid   col_2_0_,   addressent5_.addressname col_3_0_,.as col_4_0_, pets6_.itemid itemid1_4_, pets6_.connected connecte2_4_, pets6_.objectstatecode objectst3_4_ user user0_ 

thanks in advance, markus





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -