uk.theretiredprogrammer.nbpcg.templates.remotecreateejb.template Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nbpcg Show documentation
Show all versions of nbpcg Show documentation
Code Generator for standard Netbeans platform application
The newest version!
<#--
Copyright 2015-2017 Richard Linsdale.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<#if license = "apache20" >
/*
* Copyright ${copyright}.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if>
<#if license = "gpl30" >
/*
* Copyright (C) ${copyright}
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#if>
<#if license = "lgpl21" >
/*
* Copyright (C) ${copyright}.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#if>
<#-- Freemarker Template for Remote Create EJB -->
<#assign templateauthor = "Richard Linsdale (richard at theretiredprogrammer.uk)" />
<#assign PSTORE = persistencestore[usepersistencestore] >
<#assign ENTITY = entityinfo[useentity]>
package ${package};
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import uk.theretiredprogrammer.jeelibrary.CreateEJB;
/**
* An EJB to persist new ${ENTITY.name} Entities.
*
* (Class generated by NetBeans Platform Code Generator tools using ${DEFINITION_FILE}.
* Do not edit this file. Apply any changes to the definition file and regenerate all files.)
*
* @author ${templateauthor}
*/
@Stateless
public class ${ENTITY.name}CreateEJB extends CreateEJB<${ENTITY.name}, ${ENTITY.pkeytype}> {
@PersistenceContext(unitName = "${PSTORE.dbname}_PU")
private EntityManager em;
@Override
public EntityManager getEntityManager() {
return em;
}
@Override
protected ${ENTITY.name} getNewEntity() {
return new ${ENTITY.name}();
}
}