Comment 1 for bug 500163

Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

> @QueryInit, but it is not very neat solution - it pollutes entity class and requires "string" name.

It is true, that QueryInit is not type-safe, but we didn't come up with a better solution.

> Is it possible to do something more friendly. I could suggest several variants:
> 1. generate yet another constructor new QLink1(QEntity.entity.link1)

Could you explain this more?

> 2. generate a special function QEntity.entity.link1.init().link2.init()

We had something like this before, but dropped it, because we favored the declarative approach with QueryInit. Providing manual initializations has the disadvantage, that the property paths cannot be declared final. We keep the paths final, so manual initialization is not an option.

Another alternative would be to provide QueryInit style initializations, but declare them elsewhere. For example in a package

@Initializations({
  @Initialization(type=Entity.class, path="prop1.prop2")
  @Initialization(type=Entity2.class, path="prop3")
})

What do you think?