openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vasil <vvangelov...@gmail.com>
Subject Enhancing entities fails when there is an enum field in the entity
Date Sun, 14 Jun 2009 21:41:42 GMT

Hi

I have the following entity:

@Entity
@Table(name = "accounts_userfavorites")
public class UserFavorite implements Serializable{

	private static final long serialVersionUID = 7233246222509313691L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long id;
	
	@Column(nullable = false)
	private String channelName;
	
	@Column(nullable = true)
	private String name;
	
	@Column(nullable = true)
	private Date startTime;
	
	@Column(nullable = false)
	private Date timeAdded = new Date();
	
	public enum Type {
		CHANNEL,
		PROGRAMME,
		SERIES;
	}

	
	@Enumerated(EnumType.ORDINAL)
	@Column(nullable = false)
	private Type type;
	
    @ManyToOne(optional=false)
    @JoinColumn(name="user_account_id",referencedColumnName="id", nullable =
false)
    private UserAccount userAccount;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getChannelName() {
		return channelName;
	}

	public void setChannelName(String channelName) {
		this.channelName = channelName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getTimeAdded() {
		return timeAdded;
	}

	public void setTimeAdded(Date timeAdded) {
		this.timeAdded = timeAdded;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public UserAccount getUserAccount() {
		return userAccount;
	}

	public void setUserAccount(UserAccount userAccount) {
		this.userAccount = userAccount;
	}
	
}

however when I try to enhance it I get the following error:

java.lang.NoClassDefFoundError: Lmk/zulu/entities/UserFavorite$Type;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2259)
	at java.lang.Class.getDeclaredFields(Class.java:1715)
	at
org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:270)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.apache.openjpa.persistence.PersistenceMetaDataDefaults.getAccessType(PersistenceMetaDataDefaults.java:262)
	at
org.apache.openjpa.persistence.PersistenceMetaDataDefaults.getAccessType(PersistenceMetaDataDefaults.java:250)
	at
org.apache.openjpa.meta.AbstractMetaDataDefaults.populate(AbstractMetaDataDefaults.java:155)
	at
org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(PersistenceMetaDataDefaults.java:227)
	at
org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:794)
	at
org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:780)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaData(AnnotationPersistenceMetaDataParser.java:657)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:480)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:352)
	at
org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:229)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:474)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:294)
	at
org.apache.openjpa.meta.ValueMetaDataImpl.resolveDeclaredType(ValueMetaDataImpl.java:431)
	at
org.apache.openjpa.meta.ValueMetaDataImpl.resolve(ValueMetaDataImpl.java:410)
	at org.apache.openjpa.meta.FieldMetaData.resolve(FieldMetaData.java:1676)
	at
org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1691)
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1626)
	at
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717)
	at
org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:616)
	at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
	at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:249)
	at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4493)
	at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4440)
	at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4410)
	at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
	at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
	at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4405)
	at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:121)
	at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.execute(OpenJpaEnhancerMojo.java:86)
	at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
	at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Clearly the type field causes the problem here. Anyone have an idea why this
happens and how to fix it?
I'm using openjpa 1.2.1

-- 
View this message in context: http://n2.nabble.com/Enhancing-entities-fails-when-there-is-an-enum-field-in-the-entity-tp3077176p3077176.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message