Apache Cayenne Modeler modeling single table inheritance generated subclass with different return type

StackOverflow https://stackoverflow.com//questions/23001771

  •  20-12-2019
  •  | 
  •  

Question

Using this as an example: https://cayenne.apache.org/docs/3.0/modeling-single-table-inheritance.html.

I have an ObjEntity called Book. I have changed the Java Type for one of the attribute to use JodaTime's DateTime class. The superclass _Book() is generated correctly with get/set method that uses DateTime. For example: public void setRelease(DateTime release)

I have another ObjEntity call EBook that sets the superclass to Book() (not the same as the abstract _Book()) . In the class _EBook, I see the same method setRelease with a different signature. For example: public void setRelease(Date release)

How do I make the Modeler not create these methods?

Was it helpful?

Solution

This shouldn't happen normally. Class generator does not generate setters/getters for superclass attributes in subclass. Could it be something the DataMap XML? The most likely cause is a "release" ObjAttribute declaration in an EBook entity that "shadows" "release" ObjAttribute of the super entity. If so, you should manually remove it from the XML, and redo the classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top