Forums de discussion

Change type of sevice model attributes

Zachary Mayry, modifié il y a 7 années.

Change type of sevice model attributes

New Member Publications: 14 Date d'inscription: 24/02/17 Publications récentes
I have this package myservice.service.model.impl
with mytableImpl.java
and mytableModelImpl.java

mytableModelImpl.java has the attributes with type Date given by the service builder
I want it to be of type LocalDate but I can't edit mytableModelImpl.java directly and says to use mytableImpl.java

Is this doable?
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Change type of sevice model attributes

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
No, ServiceBuilder uses a known set of types and you cannot just change them.

You can go into mytableModelImpl and add supporting methods such as getLocalDate() that perhaps does an internal conversion on the actual Date field value to return what you need and a setLocalDate() method which receives the local date and transforms to store in the actual Date field value.