Re: [hibernate-dev] dynamic instantiation queries

2017-02-17 Thread Steve Ebersole
For completeness: https://hibernate.atlassian.net/browse/HHH-11501. Let's continue any discussion there... On Mon, Oct 24, 2016 at 6:40 PM Steve Ebersole wrote: > Still not really understanding what you are getting at. Do you have an > example? > > The entity passed into the "DTO" would be ma

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Steve Ebersole
Still not really understanding what you are getting at. Do you have an example? The entity passed into the "DTO" would be managed. If they wanted to initialize stuff on that entity it would happen just as normal for a managed entity. Is that what you mean? On Mon, Oct 24, 2016, 4:34 PM Sanne G

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Sanne Grinovero
On 24 October 2016 at 21:49, Steve Ebersole wrote: > I'm not sure what you are getting at. This is a feature Hibernate has had > for close to 15 years. It's not a "new feature", I'm just proposing a new > behavior to be more consistent with what people generally expect. Yes I like the proposal;

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread andrea boriero
I think attempting to dynamically infer what to do using the existing ctr would be great On 24 October 2016 at 21:49, Steve Ebersole wrote: > I'm not sure what you are getting at. This is a feature Hibernate has had > for close to 15 years. It's not a "new feature", I'm just proposing a new > b

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Steve Ebersole
I'm not sure what you are getting at. This is a feature Hibernate has had for close to 15 years. It's not a "new feature", I'm just proposing a new behavior to be more consistent with what people generally expect. On Mon, Oct 24, 2016, 3:30 PM Sanne Grinovero wrote: > Option 2# looks very nice

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Sanne Grinovero
Option 2# looks very nice indeed, I'd like that as it would be useful to be able to create immutable DTOs directly from a query; but I'm wondering what kind of difficulties this might pose, for example I'd assume the DTO constructor would be able to trigger lazy loading of any property of Person?

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Steve Ebersole
So Person is your entity, e.g.: @Entity class Person { @Id Long id; ... } For a query like `select new DTO( p ) from Person p` Hibernate expects a DTO like: class DTO { public DTO(Long id) { ... } } in fact a DTO like: class DTO { public DTO(Person person) {

Re: [hibernate-dev] dynamic instantiation queries

2016-10-24 Thread Vlad Mihalcea
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" Sent: ‎10/‎24/‎2016 22:21 To: "hiber