zwwcn

Just another WordPress.com site

Monthly Archives: May 2012

Conditional Rendering in ui:repeat or c:forEach

Tried the combination of ui:repeat and ui:fragment , didn’t work. for some reason it give wrong evaluation. forEach raise the “Must evaluate to a Collection, Map…” error.

The best solution is using single column h:datatable and ui:fragment.

CDATA and javascript

&& are not valid characters in XML so they are also not valid for Facelets as well.
Use script in CDATA to get full javascript support in Facelets . CDATA is used like this :

 

<script>
<![CDATA[
function check(){
if (isCondition1 &&  !isCondition2){
alert(“Please input a valid number!”)
}
}
]]>
</script>

hibernate Instantiation Exception: No default constructor for entity

In Java, the compiler will always supply a default constructor unless you define the constructor yourself. If your POJO has a constructor that takes arguments, then you don’t have a default constructor, and how can Hibernate instantiate this? Where does it get the values for the constructor from?

All your Hibernate classes must have a constructor that doesn’t take any parameters.

 

from http://www.coderanch.com/t/217866/ORM/java/hibernate-Instantiation-Exception-No-default

update discriminator for domain model

You need to create a new subtype and copy the old values in, you should not update the discriminator for existing domain.

Use “discriminator” as usual property in domain model. If you need to change “discriminator” then it meens there is no inheritance in domain model, drop it