cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Problem with generating Enum table into the database and Windchill not finding it

NT_10644494
12-Amethyst

Problem with generating Enum table into the database and Windchill not finding it

Hello, I'm trying to create my custom Enum with Java code, so I created a class 

 

 

@GenAsEnumeratedType
public class LayerEnum extends _LayerEnum {
   private static final long serialVersionUID = 1L;​
   public static final LayerEnum LAYER1 = toLayerEnum("Layer1");​
   public static final LayerEnum LAYER2 = toLayerEnum("Layer2");
}

 

 

 

Then I'm adding it as a property to my custom Part which is using it

 

 @GenAsPersistable(superClass = WTPart.class, extendable = true,
	properties={ @GeneratedProperty(name="layer", type=LayerEnum.class, initialValue = "LayerEnum.LAYER1") } ,
	foreignKeys = {@GeneratedForeignKey(foreignKeyRole=@ForeignKeyRole(name="master", type=MyPartMaster.class))})
public class MyPart extends _MyPart {
	static final long serialVersionUID = 1;
	
	public static MyPart newMyPart() throws Exception {
		final MyPart instance = new MyPart();
		instance.initialize();
		return instance;
	}
}

 

The problem I encounter is that, when I try to create the new Part I get exception which is "Cannot initialize class LayerEnum". 
Then I check that when I run the command ant -f bin/tools.xml sql_script ....  my LayerEnum is not included in the sql_script. Is that normal when creating custom Enums like that? And what can be the reason for that my enum is not being included in the SQL script -> Not registered in the Database. In fact, when I check my custom Part in the database with desc MyPart I see the column of my LayerEnum

 

2 REPLIES 2

Yes, I'm trying to creating  EnumeratedType  Subclass. 
Actually, the place from where I'm looking is this one - Modeling Business Objects (ptc.com)

Announcements

Top Tags