Java Reference
In-Depth Information
Fa├žade{
Inject an EntityManager resource.
<xsl:text disable-output-escaping="yes">@Resource
</xsl:text>
<xsl:text>private EntityManager em;</xsl:text>
The create() method is used to create and persist an entity instance.
public void create(
<xsl:apply-templates select="cmp-field">
<xsl:with-param name="paramPK" select="'paramPK'"/>
<xsl:with-param name="primKeyField" select="primkey-field"/>
</xsl:apply-templates>
) {
<xsl:value-of select="ejb-class"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate((substring(ejb-class,
1,1)),$ucletters,$lcletters)"/>
<xsl:value-of select="substring(ejb-class,2)"/>
= new
<xsl:value-of select="ejb-class"/>
(
<xsl:apply-templates select="cmp-field">
<xsl:with-param name="pkField" select="'pkField'"/>
<xsl:with-param name="primKeyField" select="primkey-field"/>
</xsl:apply-templates>
); em.persist(
<xsl:value-of select="translate((substring(ejb-class,
1,1)),$ucletters,$lcletters)"/>
<xsl:value-of select="substring(ejb-class,2)"/>
); }
The remove() method is used to remove an entity instance.
public void remove(
<xsl:value-of select="ejb-class"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate((substring(ejb-class,
1,1)),$ucletters,$lcletters)"/>
<xsl:value-of select="substring(ejb-class,2)"/>
) { em.remove(
<xsl:value-of select="translate((substring(ejb-class,
1,1)),$ucletters,$lcletters)"/>
<xsl:value-of select="substring(ejb-class,2)"/>
); }
 
Search WWH ::




Custom Search