I'm trying to upcast or downcast an entity in Java and then commit it to the database. For example, if cat is a specialization of animal: cat nowCat = (cat)animalParameter1; nowCat.settailLength(3); nowCat.setName("persian"); nowCat.commit(); This doesn't work. I get java.lang.ClassCastException: myfirstmodule.proxies.animal cannot be cast to myfirstmodule.proxies.cat at MyFirstModule.downcast (JavaAction : 'downcast_java') Thanks for any ideas.
Once again I found my own answer. You can't do it in Java. But can I copy the object and preserve everything?
Have a look at the clone Java action that is part of the Community Commons app store module. This can be used in these type of cases to copy attributes.