Hi,

Yes, the com.sample.entity.Account is an enhanced entity(and AccountType is
an enum).  And signature for the constructor is:
public Account(long id, String accountNumber, String name, AccountType
accountType, BigDecimal currentBalance);

Yes, I'm doing it for optimization and we had considered using FetchPlan but
as it is specific to OpenJPA, we choose this. Could you please suggest the
best approach for this type of scenario.

Thanks,
Prashant

On 7/24/07, Patrick Linskey <[EMAIL PROTECTED]> wrote:

Hi,

Is com.sample.entity.Account the entity type? I cannot recall if the
spec allows selecting new into the enhanced instance type, but it
certainly is not the intention, so that could be causing the problem.

Generally-speaking, if you find that you're doing a SELECT NEW into an
entity type, it probably means that you're fighting with OpenJPA --
SELECT NEW is generally meant for projection and aggregate data, not
as a means to obtain entity types. If you're doing so to achieve a
tuning optimization, you might want to consider OpenJPA's fetch plan
capabilities. Alternately, if you're just looking to load instances
from the database, you can simply change the query to 'SELECT x FROM
Account AS x'.

-Patrick

Reply via email to