I want to do is a copy of DetalleCompra and persist both original and the copy
efrainfari Mar 24, 2010 10:29 PMHello..... help
I want to do is a copy of DetalleCompra and persist both original and the copy
..................................................................
rich:modalPanel id="editarItem"
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:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j" resizeable="true" width="600" height="300">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Agregar Catalogo"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/img/close.png" id="hidelink"
styleClass="hidelink" />
<rich:componentControl for="editarItem" attachTo="hidelink"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<h:form id="guardar">
<s:validateAll>
<rich:panel >
<f:facet name="header">Agregar Item</f:facet>
<h:panelGrid columns="3" rowClasses="prop" columnClasses="name,value">
<h:outputLabel for="items">cant</h:outputLabel>
<h:inputText value="#{detalleCompraHome.instance.dmsCantidad}" id="cant"/>
<h:commandButton value="calcular" action="none" actionListener="#{detalleCompraHome.calculaporcentaje}"/>
<h:outputLabel for="itemd">Catalogo</h:outputLabel>
<h:inputText value="#{detalleCompraHome.instance.item}" id="itemd" converter="#{itemConverter}" style="text-transform:uppercase" size="30"/>
<rich:suggestionbox id="suggestionBoxId" for="itemd"
suggestionAction="#{itemBodegaHome.findItem}" var="result"
fetchValue="#{result.catalogo.eqcCodeqc}" tokens="," height="200" width="300" cellpadding="2"
cellspacing="2" shadowOpacity="4" shadowDepth="4"
minChars="4" rules="none" nothingLabel="No se encontro nada">
<h:column>
<h:outputText value="#{result.catalogo.eqcCodeqc}"/>
</h:column>
<h:column>
<h:outputText value="#{result.catalogo.eqcDescri}" />
</h:column>
</rich:suggestionbox>
</h:panelGrid>
</rich:panel>
</s:validateAll>
<div class="actionButtons">
<h:commandButton value="Guardar" action="#{detalleCompraHome.persist}" rendered="#{!detalleCompraHome.isManaged()}"/>
<h:commandButton value="Guardar" action="#{detalleCompraHome.update}" oncomplete = "('editarCatalogo').component.hide()" rendered="#{detalleCompraHome.isManaged()}"/>
<h:commandButton value="Regresar" action="cancelar" immediate="true"/>
</div>
</h:form>
</rich:modalPanel>
public class DetalleCompraHome extends EntityHome<DetalleCompra>
.
.
.
@Override
public String persist()
{
this.getInstance().setDmsCantidad(this.getInstance().getDmsCantidad());
this.getInstance().setItem(this.getInstance().getItem());
System.out.println(this.getInstance().getDmsCantidad());
System.out.println(this.getInstance().getItem());
String s = super.persist();
this.getInstance().setDmsCantidad(this.getInstance().getDmsCantidad());
this.getInstance().setItem(this.getInstance().getItem());
System.out.println(this.getInstance().getDmsCantidad());
System.out.println(this.getInstance().getItem());
String s1 = super.persist();
return s+"D";
}
I do not have any idea