Page 1 of 1

non duplicated list

Posted: Mon Mar 04, 2013 11:25 pm
by julia
Hello,

I have customer and customer type entity class. I used ManyToMany bi direction relationship. When I add new customer, I can add duplicated customer type. I don't want duplicated customer type in customer. Customer types are not duplicated for one customer.
I would like to know how can I do.

Thanks.

Re: non duplicated list

Posted: Tue Mar 05, 2013 4:04 pm
by phillipuniverse
You will need to have a CustomPersistenceHandler which extends CustomPersistenceHandlerAdapter for the CustomerType entity. Override the canHandleFetch() and fetch() methods in this implementation and filter out the types that are already added for that customer.