[jboss-user] [JBoss Seam] - One to one doubt

nandolins do-not-reply at jboss.com
Tue Sep 12 16:16:22 EDT 2006


i having some problems trying to persist an object with a one to one relation, it is working, but there must be a better way. Let me show you:
 View:

  | <tr>
  | 					<td>Codigo</td>
  | 					<td><h:inputText value="#{assuntoProcesso.codigo}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Descrição</td>
  | 					<td><h:inputText value="#{assuntoProcesso.descricao}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Codigo Natureza</td>
  | 					<td><h:inputText value="#{naturezaProcesso.codigo}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Descrição Natureza</td>
  | 					<td><h:inputText value="#{naturezaProcesso.descricao}" required="true" /></td>
  | 				</tr>
  | 
Action:
@In
  | 	@Out
  | 	@Valid
  | 	private AssuntoProcesso assuntoProcesso = new AssuntoProcesso();
  | 	
  | 	@In
  | 	@Out
  | 	@Valid
  | 	private NaturezaProcesso naturezaProcesso;
  | 
And setting the variable naturezaProcesso to assuntoProcesso then.
but this looks kind of stupid, declaring the two variables, it would be much more simple to use a view like this:

  | <tr>
  | 					<td>Codigo</td>
  | 					<td><h:inputText value="#{assuntoProcesso.codigo}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Descrição</td>
  | 					<td><h:inputText value="#{assuntoProcesso.descricao}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Codigo Natureza</td>
  | 					<td><h:inputText value="#{assuntoProcesso.naturezaProcesso.codigo}" required="true" /></td>
  | 				</tr>
  | 				<tr>
  | 					<td>Descrição Natureza</td>
  | 					<td><h:inputText value="#{assuntoProcesso.naturezaProcesso.descricao}" required="true" /></td>
  | 				</tr>
  | 

But i getting errors with this one, anybody can help me?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971115#3971115

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971115




More information about the jboss-user mailing list