Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Preventing polymorphic selects in JPQL

Hi Daniel,

You can configure the InheritancePolicy on our ClassDescriptors not to read subclasses. To do this, create a DescriptorCustomizer for the class you want to change the behavior of and call descriptor.getInheritancePolicy().setShouldReadSubclasses(false).

-Tom

Maranan, Daniel wrote:
Hi Everyone,

Is there a way to prevent a select from producing the results of all of the subclasses of a class? I only need the data from the super class.

Just for some background info, here is a small snipped of the super class. What I’m trying to access are names, postalAddresses, telephoneNumbers, and emailAddresses. This class is the parent of several subclasses.

@Inheritance(strategy = InheritanceType./JOINED/)

*public* *abstract* *class* _ConstituentEntity_ *implements* Constituent {

@OneToMany(mappedBy = "constituent", targetEntity = NameEntity.*class*, fetch = FetchType./EAGER/)

      @XmlTransient

      *protected* Set<Name> names;

@OneToMany(mappedBy = "constituent", targetEntity = PostalAddressEntity.*class*)

      *protected* List<PostalAddress> postalAddresses;

@OneToMany(mappedBy = "constituent", targetEntity = TelephoneNumberEntity.*class*)

      *protected* List<TelephoneNumber> telephoneNumbers;

@OneToMany(mappedBy = "constituent", targetEntity = EmailAddressEntity.*class*)

      *protected* List<EmailAddress> emailAddresses;

Thanks,
Dan


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top