Great library! Can you show us an example how to transform DatePicker to S

Great library!

Can you show us an example how to transform DatePicker to String when I save it to the CRUD database?

crudFormFactory.setFieldType("date", DatePicker.class); // This works, but saving causes error...
Caused by: java.lang.ClassCastException: Cannot cast java.time.LocalDate to java.lang.String

Before saving the data you should convert to String. That can be done at the service layer or at the CrudListener or CrudOperation level.

I don’t understand. If I need to convert the LocalDate to String, I cannot cast it to String here. I don’t know how to get the LocalDate object.

// Listener
		userLoggCrud.setCrudListener(new CrudListener<UserLogg>() {

			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public Collection<UserLogg> findAll() {
				return userLoggRepository.findAll();
			}

			@Override
			public UserLogg add(UserLogg domainObjectToAdd) {			
				return userLoggRepository.save(domainObjectToAdd);
			}

			@Override
			public UserLogg update(UserLogg domainObjectToUpdate) {
				return userLoggRepository.save(domainObjectToUpdate);
			}

			@Override
			public void delete(UserLogg domainObjectToDelete) {
				userLoggRepository.delete(domainObjectToDelete);
			}

		});
		setContent(userLoggCrud);

How it’s working. Did not knew that I coluld use “LocalDate” in the database entity.