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 04:09:59 GMT
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.
>

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