[JBoss Seam] - Losing web page state on validation error with HibernateEnti
by jcelanoï¼ netkey.com
I am using Seam 2.0 CR4 with Jboss 4.2 and Hibernate and my applications is deployed as a WAR.
I have a simple page (startPage.xhtml) that links to another page (userInfo.xhtml) that is backed by a HibernateEntityHome object (UserHome.java). When i first navigate to the userInfo page, all works as desired. The user information is loaded and it appears that the entity is managed (e.g. the update button is displayed, not the add button).
My problem is this, if there is a validation error (e.g. phone number not the correct format), then it appears that the entity is not managed anymore (e.g. the add button is displayed instead of the update button). What am i doing wrong?
Any help would be appreciated. If you need more information or code, please let me know.
Pages.xml snip...
| <page view-id="/userinfo.xhtml" login-required="true">
| <param name="id" value="#{userHome.id}"/>
| <navigation>
| <rule if-outcome="created">....</rule>
| </navigation>
| </page>
|
Link snip....
| <h:outputLink value="userinfo.seam">
| <f:param value="#{user.id}" name="id"></f:param>
| User - Edit Current User
| </h:outputLink>
|
UserInfoHome.java snip....
| @RequestParameter
| protected Integer id;
| public Integer getId() {
| log.info("getId() called id={0}", id);
| return id;
| }
|
|
| public void setId(Integer netkeyEntityId) {
| log.info("setId() called id={0}, netkeyEntityId={1}", id, netkeyEntityId);
| id = netkeyEntityId;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099469#4099469
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099469
18Â years, 6Â months
[JBoss Portal] - Feedback wanted. Would you choose JB Portal again?
by wheezer
We've been evaluating Jboss vs Liferay and Jetspeed. It's hard to find really good reviews or success stories and evangelists. It seems that Red Hat should give JBP a big lift over Liferay and others, but that's speculative. We liked Liferay, but the community seems very quiet, and the liferay company seems more focused on their commercial support, than really pumping their community.
All of the portals have fewer open source portlets than we imagined they would have. Logic says that Red hat's involvement might rev up the portlet development, and probably here at JBP first, but logic has been wrong before. It's been a year and a half. Is that happening, or....?
We could really profit from some feedback from JBoss Portal users who have serious experience with it, and perhaps the other portals.
So if you were given a second chance, would you still choose JB Portal, or go another route? If not, what might you choose instead? We've learned on other sites that questions like this get a lot of response. They can be VERY very helpful to we seekers looking to find the right solution.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099468#4099468
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099468
18Â years, 6Â months
[JBoss Seam] - Seam 2.0.0 and hibernate search
by slavosk
Hello,
Did someone tried succesfully to configure hibernate search with seam2 ?
I'm evaluating the seam & hsearch solution and need a little help.
I have a problem to create an index. I have a seam-gen generated project and configured hibernate search following way:
persistence.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <!-- Persistence deployment descriptor for prod profile -->
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="crud9">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/crud9Datasource</jta-data-source>
| <properties>
| <!-- <property name="hibernate.hbm2ddl.auto" value="validate"/> -->
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.jdbc.batch_size" value="20"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/crud9EntityManagerFactory"/>
| <property name="hibernate.default_schema" value="core"/>
|
| <!-- use a file system based index -->
| <property name="hibernate.search.default.directory_provider"
| value="org.hibernate.search.store.FSDirectoryProvider"/>
| <!-- directory where the indexes will be stored -->
| <property name="hibernate.search.default.indexBase"
| value="/data/hs_index"/>
|
| </properties>
| </persistence-unit>
|
| </persistence>
|
|
application.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <application xmlns="http://java.sun.com/xml/ns/javaee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
| version="5">
|
| <display-name>crud9</display-name>
|
| <module>
| <web>
| <web-uri>crud9.war</web-uri>
| <context-root>/crud9</context-root>
| </web>
| </module>
|
| <module>
| <ejb>crud9.jar</ejb>
| </module>
|
| <!-- Seam and EL -->
| <module>
| <ejb>jboss-seam.jar</ejb>
| </module>
| <module>
| <ejb>hibernate-search.jar</ejb>
| </module>
| <module>
| <ejb>hibernate-commons-annotations.jar</ejb>
| </module>
| <module>
| <ejb>lucene-core-2.2.0.jar</ejb>
| </module>
|
| </application>
|
Entity annotations:
|
| @Entity
| @Table(name = "products")
|
| @Indexed(index="products")
| public class PrProduct implements java.io.Serializable {
| ....
| @Id
| @DocumentId
| @Column(name = "product_id", unique = true, nullable = false, length = 20)
| @NotNull
| @Length(max = 20)
| public String getProductId() {
| return this.productId;
| }
|
| ....
| @Column(name = "name", length = 128)
| @Field(index=Index.TOKENIZED,store=Store.YES)
| @Length(max = 128)
|
| public String getName() {
| return this.name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
| ...
| @Column(name = "desc", length = 4000)
| @Field(index=Index.TOKENIZED,store=Store.YES)
| @Length(max = 4000)
| public String geDesc() {
| return this.desc;
| }
| ....
|
More fields (ca 10), but I tried to index theese...
I don't become any error, but I don't see anything under /data/hs_index after I run following indexing code:
|
| @Name("prProductHome")
|
| public class PrProductHome extends EntityHome<PrProduct> {
| @In
| EntityManager entityManager;
|
| ....
| public String createHsIndex(){
| try {
| FullTextEntityManager ftEm = (FullTextEntityManager) entityManager;
| Query q = entityManager.createQuery("select prProduct from PrProduct prProduct");
|
| List<PrProduct> products = q.setMaxResults(200).getResultList();
|
| for (PrProduct prProduct : products) {
| ftEm.index(prProduct);
| }
|
| } catch (Exception e) {
| log.error("Probleeeem: #0", e.getMessage());
| }
| return "OK";
| }
|
| ....
|
Can you give me a hint what's wrong or where to search ???
Versions: (From JBoss Log)
Hibernate EntityManager 3.2.1.GA
Hibernate Annotations 3.2.1.GA
Hibernate 3.2.4.sp1
Hibernate Search 3.0.0.CR1.HSEARCH-116
Thank you,
SlavoSk
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099466#4099466
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099466
18Â years, 6Â months