zwwcn

Just another WordPress.com site

Monthly Archives: November 2014

cannot simultaneously fetch multiple bags

ref from http://stackoverflow.com/questions/17566304/multiple-fetches-with-eager-type-in-hibernate-with-jpa

The root cause of the problem is that when Hibernate fetches SQL query results there is no simple way to tell which child element belongs to which collection. See this blog entry for more detailed explanation with an example. To summarize you have following workarounds:

  • Load each collection separately using subselect @Fetch(FetchMode.SELECT)
  • Force usage of list instead of bag by adding index column @IndexColumn(name="LIST_INDEX")
  • Use unordered collection like Set.

Enter key to submit form in JSF

Add a hidden button in the form:


<h:commandButton id="hiddenSearch" style="visibility: hidden;" action="#{someAction.search}"/>

JsonMappingException: No suitable constructor found for type

You need a no-argument constructor for your entity