hibernate - HQL insert ... select with parameters -


i need execute batch insert select statement:

query query = em         .createquery(         "insert entitya (a,b,entity_field) select t.a, t.b,           :entity_field entitya t ..."); query.setparameter("entity_field ", entity); 

field entity_field not primitive type in entitya getting java.lang.illegalargumentexception: org.hibernate.queryexception: number of select types did not match insert.

is there way that?

when put in select field not primitive type it's decomposite in properties. have query this:

insert (a, b, entity_field) select t.a, t.b, entity_field.field1, entity_field.field2,...., entity_field.fieldn 

when insert put primary key of entity, can use primitive type.

i hope, clear ;) have nice day


Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -