openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Goodson <matt...@spidertracks.co.nz>
Subject Re: Enhancement skipping field
Date Thu, 07 Jul 2011 22:15:59 GMT
Yeah <entity>_ classes don't need to enhanced but the plugin doesn't exclude
them but it doesn't affect the application so I'm not too worried.
Its the Phone.id field that is not being enhanced that's causing my problem.
Thanks

On Fri, Jul 8, 2011 at 9:35 AM, Kevin Sutter <kwsutter@gmail.com> wrote:

> Hi Matthew,
> Not sure which maven plugin or ant script is being used for your build-time
> enhancement, but can it be modified to exclude the generated <entity>_
> classes?  These should not be run through the enhancer.
>
> Also, just to verify...  You are generating these <entity>_ classes on
> purpose, correct?  These underscored classes are generated metamodel
> classes
> in support of the Metamodel and Criteria APIs.  Is your application using
> one or both of these new features in JPA 2.0?  Just checking...
>
> Thanks,
> Kevin
>
> On Thu, Jul 7, 2011 at 4:27 PM, Matthew Goodson
> <matthew@spidertracks.co.nz>wrote:
>
> > Hi,
> >
> > Kevin: We're using maven and it is picking up the Phone_ class and
> > generating the warning
> >
> > here's the link for the uuid class that we're using
> >
> >
> https://github.com/stephenc/eaio-uuid/blob/master/src/main/java/com/eaio/uuid/UUID.java
> >
> > And the persistence xml...
> >
> > <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
> >  version="2.0">
> >  <persistence-unit name="openjpa">
> >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> >
> >
> >    <!-- base package -->
> >    <class>com.spidertracks.aviator.model.Persistable</class>
> >    <class>com.spidertracks.aviator.model.UuidEntity</class>
> >
> >
> >    <!-- cluster -->
> >    <class>com.spidertracks.aviator.model.cluster.ClusterRegion</class>
> >    <class>com.spidertracks.aviator.model.cluster.SpiderRegion</class>
> >
> >    <!-- security -->
> >
> >
> >
> <class>com.spidertracks.aviator.model.security.AviatorRememberMeToken</class>
> >
> >    <!-- sms -->
> >
>  <class>com.spidertracks.aviator.model.sms.PhoneValidationMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.ReceivedSmsMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SentSmsMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SmsMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SosClosedMessage</class>
> >
> >
> <class>com.spidertracks.aviator.model.sms.SosInvalidResponseMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SosMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SosTierOneMessage</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.sms.SosTierOneReopenedUserMessage</class>
> >    <class>com.spidertracks.aviator.model.sms.SosTierTwoMessage</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.sms.SosTierTwoReopenedUserMessage</class>
> >
>  <class>com.spidertracks.aviator.model.sms.SosTierTwoUserMessage</class>
> >
> >
> >    <!-- Sos -->
> >    <class>com.spidertracks.aviator.model.sos.ContactedPerson</class>
> >    <class>com.spidertracks.aviator.model.sos.OpenHistory</class>
> >    <class>com.spidertracks.aviator.model.sos.SoS</class>
> >
> >    <!-- spider -->
> >    <class>com.spidertracks.aviator.model.spider.Spider</class>
> >
> >    <!-- message -->
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.AlertAcknowlege</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.ConfigMessageUpdate</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.DistanceSettings</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.MobileTerminatedConfirmation</class>
> >
> > <class>com.spidertracks.aviator.model.spider.message.SpiderUpdate</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.SpiderwatchSettings</class>
> >
> >
> >
> <class>com.spidertracks.aviator.model.spider.message.TimeDistanceSettings</class>
> >
> > <class>com.spidertracks.aviator.model.spider.message.TimeSettings</class>
> >    <class>com.spidertracks.aviator.model.spider.message.WatchOff</class>
> >    <class>com.spidertracks.aviator.model.spider.message.WatchOn</class>
> >
> >
> >    <!-- user -->
> >    <class>com.spidertracks.aviator.model.user.ContactLink</class>
> >    <class>com.spidertracks.aviator.model.user.Address</class>
> >    <class>com.spidertracks.aviator.model.user.Customer</class>
> >
> > <class>com.spidertracks.aviator.model.user.EmailConfirmationToken</class>
> >    <class>com.spidertracks.aviator.model.user.HashedUserToken</class>
> >    <class>com.spidertracks.aviator.model.user.InvitedPerson</class>
> >    <class>com.spidertracks.aviator.model.user.PasswordResetToken</class>
> >    <class>com.spidertracks.aviator.model.user.Person</class>
> >    <class>com.spidertracks.aviator.model.user.User</class>
> >    <class>com.spidertracks.aviator.model.user.Vehicle</class>
> >    <class>com.spidertracks.aviator.model.user.Phone</class>
> >
> >    <properties>
> >      <property name="me.prettyprint.hom.classpathPrefix"
> >        value="com.datastax.hectorjpa.bean" />
> >      <property name="me.prettyprint.hom.keyspace" value="TestKeyspace" />
> >      <property name="me.prettyprint.hom.clusterName" value="TestPool" />
> >      <property name="me.prettyprint.hom.hostList" value="localhost:9161"
> />
> >      <property name="openjpa.BrokerFactory" value="abstractstore" />
> >
> >      <property name="openjpa.abstractstore.AbstractStoreManager"
> >        value="com.datastax.hectorjpa.store.CassandraStoreManager" />
> >      <property name="openjpa.MetaDataRepository"
> >        value="com.datastax.hectorjpa.store.CassandraMetaDataRepository"
> />
> >
> >      <property name="openjpa.Optimistic" value="false" />
> >      <property name="openjpa.LockManager" value="none" />
> >      <property name="openjpa.ConnectionURL" value="localhost:9161" />
> >      <!-- explicitly disable runtime enhancement support. It breaks a lot
> >        of proxy functionality needed for indexing -->
> >      <property name="openjpa.RuntimeUnenhancedClasses"
> value="unsupported"
> > />
> >
> >       <property name="openjpa.DetachState"
> >  value="all(DetachedStateField=true)"/>
> >
> >      <!-- Used to test the serialization property. If not set will
> default
> >        to java default serialization -->
> >      <property name="com.datastax.jpa.embeddedserializer"
> >        value="com.datastax.hectorjpa.serialize.XStreamSerializer" />
> >      <property name="openjpa.EntityManagerFactory"
> >        value="me.prettyprint.hom.EntityManagerFactoryImpl" />
> >
> >    </properties>
> >  </persistence-unit>
> >
> > </persistence>
> >
> >
> > On Fri, Jul 8, 2011 at 3:36 AM, Kevin Sutter <kwsutter@gmail.com> wrote:
> >
> > > Why are we attempting to enhance a generated metamodel class?
> > >
> > > "class com.spidertracks.aviator.model.user.Phone_"
> > >
> > > Classes that end in an underscore were probably generated for the
> > metamodel
> > > and/or criteria API usage.  So, something seems out of whack with
> > > attempting
> > > to enhance these classes.
> > >
> > > Kevin
> > >
> > > On Thu, Jul 7, 2011 at 7:53 AM, Rick Curtis <curtisr7@gmail.com>
> wrote:
> > >
> > > > Can you post your UUID class and the contents of your
> persistence.xml?
> > > >
> > > > Thanks,
> > > > Rick
> > > >
> > > > On Wed, Jul 6, 2011 at 11:09 PM, Matthew Goodson <
> > > > matthew@spidertracks.co.nz
> > > > > wrote:
> > > >
> > > > > Just adding the class for reference
> > > > >
> > > > > @Embeddable
> > > > > //public class Phone extends EmbeddedUUID implements
> WebOptionString,
> > > > > Serializable {
> > > > > public class Phone implements WebOptionString, Serializable {
> > > > >
> > > > > private static final long serialVersionUID = 1L;
> > > > >
> > > > >  @Persistent
> > > > > private UUID id;
> > > > >  @Persistent
> > > > > @NotEmpty(message = "{phone.number.required}")
> > > > > @NumericString(message = "{phone.number.digitsonly}")
> > > > > private String number;
> > > > >
> > > > > @Persistent
> > > > > private String countryIdd;
> > > > >
> > > > > @Persistent
> > > > > @NotNull(message = "{phone.country.required}")
> > > > > private String iddCountryCode;
> > > > >
> > > > > @Persistent
> > > > > @NotNull(message = "{phone.type.required}")
> > > > > private PhoneType type;
> > > > >
> > > > > public Phone() {
> > > > > id = new UUID();
> > > > > }
> > > > >
> > > > > public Phone(String number, Country country, PhoneType type) {
> > > > > this();
> > > > > this.number = number;
> > > > > this.type = type;
> > > > > setIddCountry(country);
> > > > > }
> > > > >
> > > > > public void setNumber(String number) {
> > > > > this.number = number;
> > > > > }
> > > > >
> > > > > public String getNumber() {
> > > > > return number;
> > > > > }
> > > > >
> > > > > public void setType(PhoneType type) {
> > > > > this.type = type;
> > > > > }
> > > > >
> > > > > public PhoneType getType() {
> > > > > return type;
> > > > > }
> > > > >
> > > > > @Override
> > > > > public String getDisplayString() {
> > > > > return number;
> > > > > }
> > > > >
> > > > > public void setIddCountry(Country country) {
> > > > > if (country != null) {
> > > > > this.iddCountryCode = country.getCode();
> > > > > this.countryIdd = country.getIdd();
> > > > > }
> > > > > }
> > > > >
> > > > > public Country getIddCountry() {
> > > > > if (iddCountryCode != null) {
> > > > > return CountryFactory.INSTANCE.getByCode(this.iddCountryCode);
> > > > > }
> > > > > return null;
> > > > > }
> > > > >
> > > > > public String getIddCountryCode() {
> > > > > return iddCountryCode;
> > > > > }
> > > > >
> > > > > public String getFullNumber() {
> > > > > return (countryIdd == null ? "" : countryIdd) + (number == null ?
> ""
> > :
> > > > > number);
> > > > > }
> > > > >  public void clone(Phone other) {
> > > > > Assert.notNull(other);
> > > > > setIddCountry(other.getIddCountry());
> > > > > setNumber(other.getNumber());
> > > > > setType(other.getType());
> > > > > }
> > > > >
> > > > > public UUID getId() {
> > > > > return id;
> > > > > }
> > > > >  public void setId(UUID id) {
> > > > > Assert.notNull(id);
> > > > >  this.id = id;
> > > > > }
> > > > > }
> > > > >
> > > > >
> > > > > On Thu, Jul 7, 2011 at 3:36 PM, Matthew Goodson
> > > > > <matthew@spidertracks.co.nz>wrote:
> > > > >
> > > > > > Hi guys. I have a problem with jpa enhancement.
> > > > > > I am using version 2.1.0 and I am trying to get it to enhanced
an
> > > > object
> > > > > > 'Phone' with a field 'id' which is of type com.eaio.UUID. However
> > > when
> > > > I
> > > > > run
> > > > > > the enhancement I get the 2 warnings below.
> > > > > > Any ideas?
> > > > > >
> > > > > > 411  openjpa  WARN   [main] openjpa.MetaData - Field "
> > > > > > com.spidertracks.aviator.model.user.Phone.id" is not a type
that
> > is
> > > > > > persistent by default.  If you want this field to be persistent,
> > you
> > > > have
> > > > > to
> > > > > > explicitly set it to persistent in your metadata.
> > > > > >
> > > > > > 681  openjpa  WARN   [main] openjpa.Enhance - Type "class
> > > > > > com.spidertracks.aviator.model.user.Phone_" loaded by
> > > > > > java.net.URLClassLoader@69dfe453 has no metadata; enhancing
as
> > > > > persistence
> > > > > > aware. If you intended for "class
> > > > > > com.spidertracks.aviator.model.user.Phone_" to be
> > > persistence-capable,
> > > > > then
> > > > > > this means that OpenJPA could not find any metadata for "class
> > > > > > com.spidertracks.aviator.model.user.Phone_". This can happen
if
> the
> > > > > > directory containing your metadata is not in your CLASSPATH,
or
> if
> > > your
> > > > > > metadata files are not named properly. See the documentation
on
> > > > metadata
> > > > > > placement for more information.
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Rick Curtis*
> > > >
> > >
> >
> >
> >
> > --
> >
> > Matthew
> >
> > Software Engineer
> >
> > Matthew Goodson | spidertracks
> >
> > po box 5203 | 117a the square | Palmerston North 4441 | new zealand
> >
> > P: +64 6 353 3395 | M: +64 27 6969639
> >
> > E: *matthew@spidertracks.co.nz* <matthew@spidertracks.co.nz>   *
> > www.spidertracks.com*
> >
> > spiderwatch - because in the rescue game, time = life.
> >
>



-- 

Matthew

Software Engineer

Matthew Goodson | spidertracks

po box 5203 | 117a the square | Palmerston North 4441 | new zealand

P: +64 6 353 3395 | M: +64 27 6969639

E: *matthew@spidertracks.co.nz* <matthew@spidertracks.co.nz>   *
www.spidertracks.com*

spiderwatch - because in the rescue game, time = life.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message