Cast entity with Java

0
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.
asked
2 answers
0

Once again I found my own answer. You can't do it in Java. But can I copy the object and preserve everything?

answered
0

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.

answered