I want a datatable to display value from DB and for that i have used JPA bean as value to datatable, it is working fine but now i want a more property to datatable for checkbox but there is no property in JPA bean that i can assign to check box. and i dont wanted to create that.
Unfortunately, you cannot. Converters can't handle binary checkbox conversion and checkboxes MUST be backed by binary. properties.
That means that unless you create a checkbox control of your own with more forgiving capabilities, you can only implement a checkbox against some sort of façade model rather than directly against the JPA object itself.
Customer surveys are for companies who didn't pay proper attention to begin with.
Ranganathan Kaliyur Mannar wrote:You can consider having a boolean field in the JPA bean and mark it with the @Transient annotation. This way, it won't be persisted and you can use it only for UI purposes.
Which is basically a decoration (similar to a façade), but it's a kludge that may confuse people when maintenance time comes. Personally, I'd feel more comfortable doing an external decoration instead of coding it into the ORM (which some shops don't allow anyway).
I should point out that in a few ORM systems, there's a provision within the ORM itself to convert values to/from non-boolean to boolean properties at the ORM level. It's not standard, however, so I didn't mention it initially.
Ok, so, you mean in the backing bean i.e have the ORM model as an instance variable in the backing bean and other boolean instance variables for the UI?
yah, that will be cleaner though the EL be will be longer...
subject: How to use JPA bean and external property with datatable