Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] implicit @Basic annotation and fetchType

Hi Tom,

Looks like a runtime bug to me, at least given my interpretation of the JPA spec. Your runtime is either assuming the picture attribute is transient or not honoring the eager fetch type for default basic mappings. I would think those defaults should apply whether the Basic annotation exists or not. The runtime also might not be defaulting byte[] to a basic mapping.

Karen


Tom Mutdosch wrote:

Hi guys,

This may be a JPA runtime issue, but I thought I'd check with all you intelligent folk here first :) Is an attribute that has no annotation treated as a basic attribute (as if it had an assumed @Basic annotation)?

I thought that was the case, but I have a scenario where an EMP_PHOTO entity has a byte array and is generated by Dali such as:
@Lob
private byte[] picture;

I execute a query that returns a list of EMP_PHOTOs, but for each instance, the picture attribute is set to null. I assumed that the default fetch type should be EAGER for that attribute. If I add the @Basic annotation:
@Lob
@Basic
private byte[] picture;

Then all of the picture attributes are filled properly. Is this behavior expected? I am wondering if this is happening because the fetchType is only being honored if the Basic annotation is set. It confused me because the Dali JPA Details view was showing the fetchType as EAGER when I didn't have the @Basic annotation, but the behavior wasn't corresponding to that until the annotation was explicitly added. I'm not sure if this is a runtime bug, or just how it is meant to work.

Thanks
Tom
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev



Back to the top