Do you mean we should allow the dynamic instantiation to resolve entities when 
we pass the entity identifier?

I think I saw this request on StackOverflow once. 

Did I understand the question properly?

Vlad


-----Original Message-----
From: "Steve Ebersole" <st...@hibernate.org>
Sent: ‎10/‎24/‎2016 22:21
To: "hibernate-dev" <hibernate-dev@lists.jboss.org>
Subject: [hibernate-dev] dynamic instantiation queries

Historically (well before JPA) HIbernate would handle dynamic instantiation
queries in cases where one of the arguments being an entity-reference by
passing just the entity's identifier rather than a complete reference to
the entity.  To be clear, I am talking about a query like:

    select new DTO( p ) from Person p

Hibernate implicitly treats this like:

    select new DTO( p.id ) from Person p

and expects DTO to have a ctor taking the appropriate ID type.

JPA came along and also defines support for dynamic instantiation queries,
but does not specify one way or the other how this case should be handled.
I have been told other providers interpret this the opposite way.  Makes
sense.  I think it is time we at least allow that as an option.  Or maybe a
nicer implementation that looks for both and picks the available one (if
that's not too much effort).

What do y'all think?
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to