[JBoss Seam] - Please help ! Can't persist data into related tables
by juk
Hello !
I'm trying to persist some data into related tables for more then a week, but it's not working at all..
Please Help !
This is the code...
| package com.st.st;
| // Generated 06.02.2008 1:13:21 by Hibernate Tools 3.2.0.b10
|
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
|
| import javax.persistence.GeneratedValue;
| import static javax.persistence.GenerationType.IDENTITY;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.ManyToOne;
| import javax.persistence.Table;
| import org.hibernate.validator.NotNull;
|
| /**
| * Info generated by hbm2java
| */
| @Entity
| @Table(name = "info", catalog = "seamtest")
| @Name("info")
| public class Info implements java.io.Serializable {
|
| private Integer infoId;
| private User user;
| private int infoFullPayment;
|
| public Info() {
| }
|
| public Info(User user, int infoFullPayment) {
| this.user = user;
| this.infoFullPayment = infoFullPayment;
| }
|
| @Id
| @GeneratedValue(strategy = IDENTITY)
| @Column(name = "info_id", unique = true, nullable = false)
| public Integer getInfoId() {
| return this.infoId;
| }
|
| public void setInfoId(Integer infoId) {
| this.infoId = infoId;
| }
| @ManyToOne(fetch = FetchType.LAZY)
| @JoinColumn(name = "user_id", nullable = false)
| @NotNull
| public User getUser() {
| return this.user;
| }
|
| public void setUser(User user) {
| this.user = user;
| }
|
| @Column(name = "info_full_payment", nullable = false)
| @NotNull
| public int getInfoFullPayment() {
| return this.infoFullPayment;
| }
|
| public void setInfoFullPayment(int infoFullPayment) {
| this.infoFullPayment = infoFullPayment;
| }
|
| }
|
| package com.st.st;
| // Generated 06.02.2008 1:13:21 by Hibernate Tools 3.2.0.b10
|
| import java.util.HashSet;
| import java.util.Set;
| import javax.persistence.CascadeType;
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.GeneratedValue;
| import static javax.persistence.GenerationType.IDENTITY;
| import javax.persistence.Id;
| import javax.persistence.OneToMany;
| import javax.persistence.Table;
| import org.hibernate.validator.NotNull;
|
| /**
| * User generated by hbm2java
| */
| @Entity
| @Table(name = "user", catalog = "seamtest")
| @Name("user")
| public class User implements java.io.Serializable {
|
| private Integer userId;
| private int userPayment;
| private Set<Info> infos = new HashSet<Info>(0);
|
| public User() {
| }
|
| public User(int userPayment) {
| this.userPayment = userPayment;
| }
| public User(int userPayment, Set<Info> infos) {
| this.userPayment = userPayment;
| this.infos = infos;
| }
|
| @Id
| @GeneratedValue(strategy = IDENTITY)
| @Column(name = "user_id", unique = true, nullable = false)
| public Integer getUserId() {
| return this.userId;
| }
|
| public void setUserId(Integer userId) {
| this.userId = userId;
| }
|
| @Column(name = "user_payment", nullable = false)
| @NotNull
| public int getUserPayment() {
| return this.userPayment;
| }
|
| public void setUserPayment(int userPayment) {
| this.userPayment = userPayment;
| }
| @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
| public Set<Info> getInfos() {
| return this.infos;
| }
|
| public void setInfos(Set<Info> infos) {
| this.infos = infos;
| }
|
| }
|
|
| package com.st.st;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
|
| import com.st.st.insert;
| @Name("insert")
| public @Stateless class insertBean implements insert {
| @In private User user;
| @In private Info info;
| @PersistenceContext private EntityManager em;
|
| public void insert(Integer userPayment, Integer infoFullPayment){
|
| Info info = new Info();
| info.setInfoFullPayment(infoFullPayment);
|
| User user = new User();
| userPayment = infoFullPayment*2;
| user.setUserPayment(userPayment);
|
| info.setUser(user);
| em.persist(info);
| }
|
| }
|
| package com.st.st;
|
| import javax.ejb.Local;
|
| @Local
| public interface insert {
| public void insert(Integer userPayment, Integer infoFullPayment);
|
| }
|
|
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:a="http://richfaces.org/a4j"
| xmlns:rich="http://richfaces.org/rich"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h:form>
| <h:inputText value="#{info.infoFullPayment}"/>
| <h:commandButton value="push" action="#{insert.insert}"/>
| </h:form>
| </ui:define>
|
| </ui:composition>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126990#4126990
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126990
18 years, 2 months
[JBoss Seam] - Seam managed bean property not set by seam.properties
by boocjelle
I hardly believe that the mechanism of the seam.properties does not work. So I made a project using Seam-Gen that can easily be reproduced. I would be grateful to know where I am going wrong.
The project was created using Seam-Gen with the project.type=ear (please note the build.properties below).
The application can be run using the url ..
http://localhost:8080/SeamPropertiesIssue/issue.seam
It shows that the seam.properties name-value-pair <issuebean.value=Value has been set> has no effect. The output is: "Value has not been set".
The sources are ..
1. src/action/de/issue/action/IssueBean.java
2. view/issue.xhtml
3. resources/seam.properties
Seam-gen build.properties:
#Generated by seam setup
#Mon Jan 07 09:25:19 CET 2008
hibernate.connection.password=
workspace.home=C\:/java/jboss-seam-2.0.0.GA/development/
model.package=de.issue.model
driver.jar=C\:/java/jboss-seam-2.0.0.GA/seam-gen/lib/hsqldb.jar
action.package=de.issue.action
test.package=de.issue.test
database.type=hsql
richfaces.skin=DEFAULT
hibernate.default_catalog.null=
hibernate.default_schema=PROTO
database.drop=y
project.name=SeamPropertiesIssue
hibernate.connection.username=sa
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
project.type=ear
icefaces.home=
database.exists=n
jboss.home=C\:/java/jboss-4.2.2.GA
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.url=jdbc\:hsqldb\:.
Seam Managed Bean:
package de.issue.action;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
@Name("issuebean")
public class IssueBean {
@Logger
Log log;
String value="Value has not been set";
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String checkValue() {
log.info("the issue has the value #0", getValue());
return "";
}
}
View:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<h:form>
<h1>Push the button and check if the properties will set the set the seam managed valuebean</h1>
<h:outputText value="#{issuebean.value}"></h:outputText>
<h:commandButton type="submit" value="Push" action="#{issuebean.checkValue()}">
</h:commandButton>
</h:form>
seam.properties:
issuebean.value=Value has been set
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126985#4126985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126985
18 years, 2 months
[JBoss Seam] - How to passing through request parameters to the next page (
by schmatz
Hello guys,
I've got the following problem and I hope that somebody has an solution to that:
Scenario:
1. You receive an email consisting of a link to you Seam app with a verification code as request parameter.
The link looks like this:
http://localhost:8080/myapp/emailAddrConfirmator.seam?verificationCode=e3...
2. The page call to emailAddrConfirmator.xhtml is interceptd by the following page action (actually, the page doesn't even exist):
<page view-id="/emailAddrConfirmator.xhtml" login-required="true">
| <action execute="#{emailAddrConfirmator.confirm}" />
| </page>
3. As you can see a login is required before the confirm action is invoked. Because of the redirect to the login form in order to get the user logged in two problems occur:
First, as defined in components.xml the 'home' page is called after successfully logged in.
Second, the request parameter is lost, of course, because two intermediate request-response cycles have happened due to the login procedure.
Now, I want two things:
1. propagate the request parameter (or some other solution in order that I have the verification code at hand when it comes to the confirm action)
2. After logging in I don't want the redirect to the 'home' page but to the emailAddrConfirmator.xhtml.
Any help and/or other solutions are appreciated.
Thanks in advance,
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126980#4126980
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126980
18 years, 2 months
[JBoss Seam] - Re: Configuring non-ssl connection to smtp server
by erace
I am using Seam 2.0.1GA and it looks like this might be broken. I have configured mail session like this:
<mail:mail-session host="localhost" port="25"
username="someuser" password="somepass" ssl="false" />
and I get the exception:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
SMTP server accepts both TLS and nonTLS connections.
Any other way I can verify what is wrong?
Some debug logging might help:
4:10:29,260 INFO [MailSession] Creating JavaMail Session (localhost:25)
14:10:29,264 INFO [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea
14:10:29,264 INFO [MailSession] connected to mail server
14:10:29,269 INFO [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
14:10:29,269 INFO [STDOUT] DEBUG SMTP: useEhlo true, useAuth true
14:10:29,269 INFO [STDOUT] DEBUG SMTP: useEhlo true, useAuth true
14:10:29,269 INFO [STDOUT] DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false
14:10:29,285 INFO [STDOUT] 220 erace ESMTP Postfix (Ubuntu)
14:10:29,285 INFO [STDOUT] DEBUG SMTP: connected to host "localhost", port: 25
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126978#4126978
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126978
18 years, 2 months