You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(11) |
Oct
(10) |
Nov
(3) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(44) |
Feb
(30) |
Mar
(11) |
Apr
(43) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(9) |
Oct
|
Nov
(1) |
Dec
(1) |
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
(17) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <rfl...@us...> - 2007-04-05 14:12:34
|
Revision: 278 http://svn.sourceforge.net/salto-db/?rev=278&view=rev Author: rflament Date: 2007-04-05 07:12:32 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm salto-db-generator/trunk/templates/springwebapp/editor.vm salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm Added Paths: ----------- salto-db-generator/trunk/templates/springwebapp/getpkfromrequest.vm Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 14:12:32 UTC (rev 278) @@ -41,6 +41,9 @@ runVelocity(TEMPLATE_PATH, "searchcontroller.vm", srcPath + "/src/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "SearchController.java", context); + runVelocity(TEMPLATE_PATH, "editor.vm", srcPath + "/src/" + (pckName + ".webapp.editor").replace('.', '/') + "/", className + "EditorSupport.java", context); + + runVelocity(TEMPLATE_PATH, "emlist.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "EmList.jsp", context); runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); Modified: salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java 2007-04-05 14:12:32 UTC (rev 278) @@ -67,8 +67,7 @@ public String createJavaAttName(String sqlName) { - if (sqlName.indexOf("_") > 0 || sqlName.toUpperCase().equals(sqlName) - || sqlName.toLowerCase().equals(sqlName)) { + if (sqlName.indexOf("_") > 0 || sqlName.toUpperCase().equals(sqlName) || sqlName.toLowerCase().equals(sqlName)) { int len = sqlName.length(); int offset = 0; @@ -77,8 +76,7 @@ for (int i = (len - 1); i >= 0; i--) { c = sqlName.charAt(i); if (c == '_' && i + 1 + offset < len) { - javaName[i + 1 + offset] = Character.toUpperCase(javaName[i - + 1 + offset]); + javaName[i + 1 + offset] = Character.toUpperCase(javaName[i + 1 + offset]); offset++; } else { javaName[i + offset] = Character.toLowerCase(c); @@ -111,8 +109,7 @@ for (int i = (len - 1); i >= 0; i--) { c = tableName.charAt(i); if (c == '_') { - javaName[i + 1 + offset] = Character.toUpperCase(javaName[i + 1 - + offset]); + javaName[i + 1 + offset] = Character.toUpperCase(javaName[i + 1 + offset]); offset++; } else { javaName[i + offset] = Character.toLowerCase(c); @@ -137,7 +134,8 @@ } public String attribute2class(String attributeName) { - return attributeName.substring(0, 1).toUpperCase() - + attributeName.substring(1); + if (attributeName == null) + return null; + return attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1); } } \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm 2007-04-05 14:12:32 UTC (rev 278) @@ -10,6 +10,21 @@ #end #end +#set ($pk="Long") +#set ($pkname="") +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($pk=$util.getClassNameForPrimitive($col.javaAttClass)) +#set ($pkname=$util.getDoNameCreator().attribute2class($col.javaAttName)) +#end +#end +#end +#if ($util.getLength($jdoInfo.getPk()) > 1) +#set ($pk="${jdoInfo.javaClassName}PK") +#set ($pkname="${jdoInfo.javaClassName}PK") +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}.${jdoInfo.javaClassName}PK; +#end import javax.servlet.http.HttpServletRequest; import org.springframework.web.servlet.mvc.CancellableFormController; @@ -70,6 +85,9 @@ } #end + +#parse("${templatePath}/getpkfromrequest.vm") + /* * (non-Javadoc) * @@ -80,7 +98,7 @@ ${jdoInfo.javaClassName} ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = null; if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { - ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); +${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(getPkFromRequest(request)); } else { ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = new ${jdoInfo.javaClassName}(); } Modified: salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm 2007-04-05 14:12:32 UTC (rev 278) @@ -5,7 +5,21 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractController; - +#set ($pk="Long") +#set ($pkname="") +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($pk=$util.getClassNameForPrimitive($col.javaAttClass)) +#set ($pkname=$util.getDoNameCreator().attribute2class($col.javaAttName)) +#end +#end +#end +#if ($util.getLength($jdoInfo.getPk()) > 1) +#set ($pk="${jdoInfo.javaClassName}PK") +#set ($pkname="${jdoInfo.javaClassName}PK") +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}.${jdoInfo.javaClassName}PK; +#end import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; /** @@ -26,11 +40,13 @@ return this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; } +#parse("${templatePath}/getpkfromrequest.vm") + @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { - ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.deleteById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.deleteById(getPkFromRequest(request)); } //TODO: when it will be ajax : return null; Modified: salto-db-generator/trunk/templates/springwebapp/editor.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/editor.vm 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/templates/springwebapp/editor.vm 2007-04-05 14:12:32 UTC (rev 278) @@ -0,0 +1,27 @@ +package ${jdoInfo.javaPckName}.webapp.editor; + +import java.beans.PropertyEditorSupport; + +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; +#if ($util.getLength($jdoInfo.pk) > 0) +#foreach($pk in $jdoInfo.pk) +#set ($pkEntry="${pk.javaAttName}") +#end +#end + +/** + * <p>PropertyEditorSupport for ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}EditorSupport extends PropertyEditorSupport { + + public void setAsText(String text) throws IllegalArgumentException { + + ${jdoInfo.javaClassName} ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = new ${jdoInfo.javaClassName}(); + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}.set${util.DoNameCreator.attribute2class(${pkEntry})}(Long.valueOf(text)); + setValue(${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}); + } + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/getpkfromrequest.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/getpkfromrequest.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/getpkfromrequest.vm 2007-04-05 14:12:32 UTC (rev 278) @@ -0,0 +1,13 @@ + private ${pk} getPkFromRequest(HttpServletRequest request) { +#if ($util.getLength($jdoInfo.getPk()) > 1) + //TODO : get composite of the pk in request and return an instance of ${pk} + return null; +#else +#if ($pk == "Integer") + return Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id")); +#end +#if ($pk == "Long") + return Long.parseLong(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id")); +#end +#end + } \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm 2007-04-05 10:13:54 UTC (rev 277) +++ salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm 2007-04-05 14:12:32 UTC (rev 278) @@ -10,6 +10,21 @@ #end #end +#set ($pk="Long") +#set ($pkname="") +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($pk=$util.getClassNameForPrimitive($col.javaAttClass)) +#set ($pkname=$util.getDoNameCreator().attribute2class($col.javaAttName)) +#end +#end +#end +#if ($util.getLength($jdoInfo.getPk()) > 1) +#set ($pk="${jdoInfo.javaClassName}PK") +#set ($pkname="${jdoInfo.javaClassName}PK") +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}.${jdoInfo.javaClassName}PK; +#end import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -73,6 +88,9 @@ } #end + +#parse("${templatePath}/getpkfromrequest.vm") + /* * (non-Javadoc) * @@ -83,7 +101,7 @@ ${jdoInfo.javaClassName} ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = null; if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { - ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(getPkFromRequest(request)); } else { ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = new ${jdoInfo.javaClassName}(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 10:13:59
|
Revision: 277 http://svn.sourceforge.net/salto-db/?rev=277&view=rev Author: rflament Date: 2007-04-05 03:13:54 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-04-05 10:13:41 UTC (rev 276) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-04-05 10:13:54 UTC (rev 277) @@ -19,7 +19,6 @@ import salto.tool.sql.data.TableColInfo; import salto.tool.sql.data.TableInfo; -import com.salto.db.generator.Constants; import com.salto.db.generator.plugin.IGeneratorPlugin; import com.salto.db.generator.plugin.Plugins; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 10:13:47
|
Revision: 276 http://svn.sourceforge.net/salto-db/?rev=276&view=rev Author: rflament Date: 2007-04-05 03:13:41 -0700 (Thu, 05 Apr 2007) Log Message: ----------- path correction Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 09:50:19 UTC (rev 275) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 10:13:41 UTC (rev 276) @@ -33,21 +33,21 @@ info.setJavaPckName(pckName); info.setJavaClassName(className); - runVelocity(TEMPLATE_PATH, "listcontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "ListController.java", context); + runVelocity(TEMPLATE_PATH, "listcontroller.vm", srcPath + "/src/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "ListController.java", context); - runVelocity(TEMPLATE_PATH, "addupdatecontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AddUpdateController.java", context); + runVelocity(TEMPLATE_PATH, "addupdatecontroller.vm", srcPath + "/src/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AddUpdateController.java", context); - runVelocity(TEMPLATE_PATH, "ajaxdeletecontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AjaxDeleteController.java", context); + runVelocity(TEMPLATE_PATH, "ajaxdeletecontroller.vm", srcPath + "/src/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AjaxDeleteController.java", context); - runVelocity(TEMPLATE_PATH, "searchcontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "SearchController.java", context); - - runVelocity(TEMPLATE_PATH, "emlist.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "EmList.jsp", context); + runVelocity(TEMPLATE_PATH, "searchcontroller.vm", srcPath + "/src/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "SearchController.java", context); - runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); + runVelocity(TEMPLATE_PATH, "emlist.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "EmList.jsp", context); - runVelocity(TEMPLATE_PATH, "form.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "Form.jsp", context); - runVelocity(TEMPLATE_PATH, "searchform.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "SearchForm.jsp", context); + runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); + runVelocity(TEMPLATE_PATH, "form.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "Form.jsp", context); + runVelocity(TEMPLATE_PATH, "searchform.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "SearchForm.jsp", context); + } public void postExecute(JdoInfo[] infos) throws Exception { @@ -67,12 +67,12 @@ context.put("pckName", pckName); context.put("hibernateDialectHelper", new HibernateDialectHelper()); - runVelocity(TEMPLATE_PATH, "action-servlet.xml.vm", srcPath + "/../WebContent/WEB-INF/", "action-servlet.xml", context); - runVelocity(TEMPLATE_PATH, "web.xml.vm", srcPath + "/../WebContent/WEB-INF/", "web.xml", context); - runVelocity(TEMPLATE_PATH, "ApplicationResources.properties.vm", srcPath, "ApplicationResources.properties", context); - runVelocity(TEMPLATE_PATH, "index.jsp.vm", srcPath + "/../WebContent/", "index.jsp", context); - runVelocity(TEMPLATE_PATH, "menu.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", "menu.jsp", context); - runVelocity(TEMPLATE_PATH, "log4j.properties.vm", srcPath, "log4j.properties", context); + runVelocity(TEMPLATE_PATH, "action-servlet.xml.vm", srcPath + "/WebContent/WEB-INF/", "action-servlet.xml", context); + runVelocity(TEMPLATE_PATH, "web.xml.vm", srcPath + "/WebContent/WEB-INF/", "web.xml", context); + runVelocity(TEMPLATE_PATH, "ApplicationResources.properties.vm", srcPath + "/src/", "ApplicationResources.properties", context); + runVelocity(TEMPLATE_PATH, "index.jsp.vm", srcPath + "/WebContent/", "index.jsp", context); + runVelocity(TEMPLATE_PATH, "menu.jsp.vm", srcPath + "/WebContent/WEB-INF/pages", "menu.jsp", context); + runVelocity(TEMPLATE_PATH, "log4j.properties.vm", srcPath + "/src/", "log4j.properties", context); } @@ -91,7 +91,7 @@ public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { super.init(doPrefix, defaultNameOffset, srcPath, pckName); plugin = new SpringEJB3AndHibernateDAOAndTestCasesPlugin(); - plugin.init(doPrefix, defaultNameOffset, srcPath, pckName); + plugin.init(doPrefix, defaultNameOffset, srcPath + "/src", pckName); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 09:50:26
|
Revision: 275 http://svn.sourceforge.net/salto-db/?rev=275&view=rev Author: rflament Date: 2007-04-05 02:50:19 -0700 (Thu, 05 Apr 2007) Log Message: ----------- The "generator" init parameter was not useful. Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java salto-db-generator/trunk/src/com/salto/db/generator/Constants.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3HibernateDAOAndTestCasesPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernatePlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/IGeneratorPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/PojoHibernateDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SaltoDbPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-04-05 09:50:19 UTC (rev 275) @@ -59,9 +59,6 @@ private static final String DEFAULT_PLUGIN = "Salto-db"; - private static final String GENERATOR_NAME = "Salto-db Generator Ant " - + Constants.VERSION; - public void execute() throws BuildException { log("Salto-DB ANT Generator - Salto Consulting"); @@ -168,7 +165,7 @@ } } if (jdoInfos.size() > 0) { - new DataObjectCreate().creerDoSimple(GENERATOR_NAME, prefix, + new DataObjectCreate().creerDoSimple(prefix, nameOffsetInt, this.getProject().getBaseDir() + "/" + outputDir, packageName, (JdoInfo[]) jdoInfos .toArray(new JdoInfo[jdoInfos.size()]), tmpl); Modified: salto-db-generator/trunk/src/com/salto/db/generator/Constants.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2007-04-05 09:50:19 UTC (rev 275) @@ -11,4 +11,6 @@ } public static final String VERSION = "v1.0.16"; + + public static final String GENERATOR_NAME = "Salto-db Generator " + Constants.VERSION; } Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -4,8 +4,6 @@ public abstract class DefaultAbstractGeneratorPlugin implements IGeneratorPlugin { - protected String generator; - protected String doPrefix; protected String srcPath; @@ -22,8 +20,7 @@ this.defaultNameOffset = defaultNameOffset; } - public void init(String generator, String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - this.generator = generator; + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { this.doPrefix = doPrefix; this.srcPath = srcPath; this.pckName = pckName; Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -10,6 +10,8 @@ import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; +import com.salto.db.generator.Constants; + public class EJB3AndHibernateDAOPlugin extends VelocityAbstractPlugin { protected EJB3Plugin ejb3Plugin = null; @@ -27,7 +29,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); @@ -72,7 +74,7 @@ context.put("connInfo", infos[0].getConnInfo()); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("dialect", this.ejb3Plugin); @@ -103,11 +105,11 @@ } - public void init(String generator, String doPrefix, int defaultNameOffset, + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + super.init(doPrefix, defaultNameOffset, srcPath, pckName); ejb3Plugin = new EJB3Plugin(); - ejb3Plugin.init(generator, doPrefix, defaultNameOffset, srcPath, + ejb3Plugin.init(doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); } Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3HibernateDAOAndTestCasesPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3HibernateDAOAndTestCasesPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3HibernateDAOAndTestCasesPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -4,6 +4,8 @@ import java.util.HashMap; import java.util.Map; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -33,7 +35,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -5,6 +5,8 @@ import java.util.HashSet; import java.util.Map; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -32,7 +34,7 @@ context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("fks", new HashSet()); @@ -67,7 +69,7 @@ context.put("connInfo", infos[0].getConnInfo()); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator); + context.put("generatorVersion", Constants.GENERATOR_NAME); context.put("date", new Date()); context.put("dialect", this); context.put("pckName", pckName); Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernatePlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernatePlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernatePlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -5,6 +5,8 @@ import java.util.HashSet; import java.util.Map; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -22,7 +24,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_HIBERNATE); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("fks", new HashSet()); @@ -51,9 +53,9 @@ return ""; } - public void init(String generator, String doPrefix, int defaultNameOffset, + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + super.init(doPrefix, defaultNameOffset, srcPath, pckName); this.setGenerateAnnotations(false); } Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/IGeneratorPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/IGeneratorPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/IGeneratorPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -18,7 +18,7 @@ public int getDefaultNameOffset(); - public void init(String generator, String doPrefix, int defaultNameOffset, + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception; public void execute(String className, JdoInfo info) throws Exception; Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/PojoHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/PojoHibernateDAOPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/PojoHibernateDAOPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -21,11 +21,11 @@ return "Pojos + Hibernate mapping + Generic DAO"; } - public void init(String generator, String doPrefix, int defaultNameOffset, + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + super.init(doPrefix, defaultNameOffset, srcPath, pckName); HibernatePlugin hibernatePlugin = new HibernatePlugin(); - hibernatePlugin.init(generator, doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); + hibernatePlugin.init(doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); this.setEjb3Plugin(hibernatePlugin); } } Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SaltoDbPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SaltoDbPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SaltoDbPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -4,6 +4,8 @@ import java.util.HashMap; import java.util.Map; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -17,7 +19,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -7,6 +7,8 @@ import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -24,7 +26,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); @@ -59,7 +61,7 @@ context.put("connInfo", infos[0].getConnInfo()); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("dialect", this.ejb3Plugin); Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -7,6 +7,8 @@ import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -27,7 +29,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); @@ -69,7 +71,7 @@ context.put("connInfo", infos[0].getConnInfo()); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("dialect", this.ejb3Plugin); @@ -92,11 +94,11 @@ } - public void init(String generator, String doPrefix, int defaultNameOffset, + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + super.init(doPrefix, defaultNameOffset, srcPath, pckName); ejb3Plugin = new EJB3Plugin(); - ejb3Plugin.init(generator, doPrefix, defaultNameOffset, srcPath, + ejb3Plugin.init(doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); } Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 09:50:19 UTC (rev 275) @@ -4,6 +4,8 @@ import java.util.HashMap; import java.util.Map; +import com.salto.db.generator.Constants; + import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; @@ -26,7 +28,7 @@ context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + this.getShortDescription()); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); info.setJavaPckName(pckName); info.setJavaClassName(className); @@ -59,7 +61,7 @@ context.put("connInfo", infos[0].getConnInfo()); context.put("util", CreatorUtil.getInstance()); context.put("templatePath", TEMPLATE_PATH); - context.put("generatorVersion", generator + " / " + this.getShortDescription()); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("dialect", this.plugin); context.put("pckName", pckName); @@ -86,10 +88,10 @@ return "Generate a complete Spring/Hibernate and Spring MVC webapp"; } - public void init(String generator, String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { - super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { + super.init(doPrefix, defaultNameOffset, srcPath, pckName); plugin = new SpringEJB3AndHibernateDAOAndTestCasesPlugin(); - plugin.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + plugin.init(doPrefix, defaultNameOffset, srcPath, pckName); } } Modified: salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2007-04-05 09:29:17 UTC (rev 274) +++ salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2007-04-05 09:50:19 UTC (rev 275) @@ -3,12 +3,8 @@ package salto.tool.jdo; import salto.tool.ide.IdeException; -import salto.tool.jdo.data.JdoColInfo; import salto.tool.jdo.data.JdoInfo; import salto.tool.jdo.util.CreatorUtil; -import salto.tool.sql.DatabaseInfo; -import salto.tool.sql.data.TableColInfo; -import salto.tool.sql.data.TableInfo; import com.salto.db.generator.plugin.IGeneratorPlugin; import com.salto.db.generator.plugin.Plugins; @@ -155,7 +151,7 @@ * @return void * @exception JdoCreateException,IdeException */ - public void creerDoSimple(String generator, String doPrefix, + public void creerDoSimple(String doPrefix, int defaultNameOffset, String srcPath, String pckName, JdoInfo[] jdoInfos, String pluginName) throws JdoCreateException, IdeException { @@ -164,7 +160,7 @@ try { plugin = Plugins.getInstance().getPlugin(pluginName); if (plugin != null) { - plugin.init(generator, doPrefix, defaultNameOffset, srcPath, + plugin.init(doPrefix, defaultNameOffset, srcPath, pckName); for (int j = 0; j < jdoInfos.length; j++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 09:29:19
|
Revision: 274 http://svn.sourceforge.net/salto-db/?rev=274&view=rev Author: rflament Date: 2007-04-05 02:29:17 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm salto-db-generator/trunk/templates/springwebapp/list.jsp.vm salto-db-generator/trunk/templates/springwebapp/listcontroller.vm salto-db-generator/trunk/templates/springwebapp/web.xml.vm Added Paths: ----------- salto-db-generator/trunk/templates/springwebapp/ApplicationResources.properties.vm salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm salto-db-generator/trunk/templates/springwebapp/editor.vm salto-db-generator/trunk/templates/springwebapp/emlist.jsp.vm salto-db-generator/trunk/templates/springwebapp/form.jsp.vm salto-db-generator/trunk/templates/springwebapp/index.jsp.vm salto-db-generator/trunk/templates/springwebapp/log4j.properties.vm salto-db-generator/trunk/templates/springwebapp/menu.jsp.vm salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm salto-db-generator/trunk/templates/springwebapp/searchform.jsp.vm Modified: salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -9,10 +9,17 @@ <property name="connection.url">${connInfo.url}</property> <property name="connection.username">${connInfo.user}</property> <property name="connection.driver_class">${connInfo.driver}</property> -#if ($dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})) - <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}--> - <property name="dialect">$dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})</property> +#if (${hibernateDialectHelper.getHibernateDialect(${connInfo.conn.getMetaData()})}) + <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()} ${connInfo.conn.getMetaData().getDatabaseMajorVersion()}.${connInfo.conn.getMetaData().getDatabaseMinorVersion()} --> + <property name="dialect">$hibernateDialectHelper.getHibernateDialect(${connInfo.conn.getMetaData()})</property> +#if (${connInfo.conn.getMetaData().getDatabaseProductName()}=="MySQL" && ${connInfo.conn.getMetaData().getDatabaseMajorVersion()}>=5) + <!-- You can also use org.hibernate.dialect.MySQL5InnoDBDialect if all your tables are InnoDBs.--> + #else + <!-- You can also use org.hibernate.dialect.MySQLInnoDBDialect if all your tables are InnoDBs or org.hibernate.dialect.MySQLMyISAMDialect if all your tables are MyISAMs.--> + +#end +#else <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}. No dialect is known by Salto-db-generator for this database. If you know what dialect to use, please send an email to rfl...@sa... and precise that the database is "${connInfo.conn.getMetaData().getDatabaseProductName()}". Thank you. Modified: salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -22,15 +22,23 @@ </property> <property name="hibernateProperties"> <props> -#if ($dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})) - <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}--> - <prop key="hibernate.dialect">$dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})</prop> +#if (${hibernateDialectHelper.getHibernateDialect(${connInfo.conn.getMetaData()})}) + <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()} ${connInfo.conn.getMetaData().getDatabaseMajorVersion()}.${connInfo.conn.getMetaData().getDatabaseMinorVersion()} --> + <prop key="hibernate.dialect">${hibernateDialectHelper.getHibernateDialect(${connInfo.conn.getMetaData()})}</prop> +#if (${connInfo.conn.getMetaData().getDatabaseProductName()}=="MySQL" && ${connInfo.conn.getMetaData().getDatabaseMajorVersion()}>=5) + <!-- You can also use org.hibernate.dialect.MySQL5InnoDBDialect if all your tables are InnoDBs.--> + #else + <!-- You can also use org.hibernate.dialect.MySQLInnoDBDialect if all your tables are InnoDBs or org.hibernate.dialect.MySQLMyISAMDialect if all your tables are MyISAMs.--> + +#end +#else <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}. No dialect is known by Salto-db-generator for this database. - If you know what dialect to use, please send an email to rfl...@sa... and precise that the database is - "${connInfo.conn.getMetaData().getDatabaseProductName()}". Thank you. --> - <prop key="hibernate.dialect"> SET THE DATABASE DIALECT HERE </prop> -#end + If you know what dialect to use, please send an email to rfl...@sa... and precise that the database is + "${connInfo.conn.getMetaData().getDatabaseProductName()}". Thank you. + --> + <prop key="hibernate.dialect"> SET THE DATABASE DIALECT HERE </prop> +#end <prop key="hibernate.query.substitutions">Y</prop> <prop key="hibernate.show_sql">true</prop> <!-- Turn batching off for better error messages under PostgreSQL Modified: salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -26,4 +26,6 @@ int deleteById(ID id); + public List<T> findByExample(T exampleInstance, String[] excludeProperty); + } \ No newline at end of file Modified: salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -2,9 +2,16 @@ import ${pckName}.GenericDAO; import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import org.hibernate.Criteria; import org.hibernate.FlushMode; import org.hibernate.Query; +import org.hibernate.LockMode; +import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Example; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; @@ -15,6 +22,30 @@ */ public abstract class AbstractHibernateDAO<T, ID extends Serializable> extends HibernateDaoSupport implements GenericDAO<T, ID> { + private Class<T> persistentClass; + + public AbstractHibernateDAO() { + this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + } + + public Class<T> getPersistentClass() { + return persistentClass; + } + + @SuppressWarnings("unchecked") + public T getById(ID id) { + return (T) getSession().get(getPersistentClass(), id); + } + + @SuppressWarnings("unchecked") + public T getById(ID id, boolean lock) { + if (lock) { + return (T) getSession().get(getPersistentClass(), id, + LockMode.UPGRADE); + } else + return getById(id); + } + public void save(T entity) { getSession().save(entity); } @@ -38,7 +69,24 @@ delete(entity); } + @SuppressWarnings("unchecked") + public List<T> findAll() { + return findByCriteria(); + } + /** + * Use this inside subclasses as a convenience method. + */ + @SuppressWarnings("unchecked") + protected List<T> findByCriteria(Criterion... criterion) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } + + /** * This method will execute an HQL query and return the number of affected entities. */ protected int executeQuery(String query, String namedParams[], Object params[]) { @@ -76,4 +124,15 @@ return executeNamedQuery(namedQuery, null, null); } + @SuppressWarnings("unchecked") + public List<T> findByExample(T exampleInstance, String[] excludeProperty) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + Example example = Example.create(exampleInstance); + for (String exclude : excludeProperty) { + example.excludeProperty(exclude); + } + crit.add(example); + return crit.list(); + } + } Added: salto-db-generator/trunk/templates/springwebapp/ApplicationResources.properties.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/ApplicationResources.properties.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/ApplicationResources.properties.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,5 @@ +# This file has been generated by ${generatorVersion} at $date + +#foreach($jdoInfo in ${jdoInfos}) +${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}List.title=List of ${jdoInfo.javaClassName}s +#end \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -19,13 +19,56 @@ <!-- List controllers --> #foreach($jdoInfo in ${jdoInfos}) <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}ListController" class="${pckName}.webapp.controller.${jdoInfo.javaClassName}ListController"> - <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> + <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> <property name="viewName" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}List" /> </bean> #end + <!-- Add and Update controllers --> +#foreach($jdoInfo in ${jdoInfos}) + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}AddUpdateController" class="${pckName}.webapp.controller.${jdoInfo.javaClassName}AddUpdateController"> + <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + <property name="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO" /> +#end +#end + <property name="successView" value="redirect:/list${jdoInfo.javaClassName}.html" /> + <property name="formView" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Form" /> + <property name="cancelView" value="redirect:/list${jdoInfo.javaClassName}.html" /> + <property name="cancelParamKey" value="cancel" /> + <property name="commandName" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}" /> + <property name="commandClass" value="${pckName}.pojo.${jdoInfo.javaClassName}" /> + </bean> + +#end + <!-- Ajax Delete controllers --> +#foreach($jdoInfo in ${jdoInfos}) + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}AjaxDeleteController" class="${pckName}.webapp.controller.${jdoInfo.javaClassName}AjaxDeleteController"> + <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> + </bean> + +#end + + <!-- Search controllers --> +#foreach($jdoInfo in ${jdoInfos}) + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}SearchController" class="${pckName}.webapp.controller.${jdoInfo.javaClassName}SearchController"> + <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + <property name="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO" /> +#end +#end + <property name="successView" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}SearchForm" /> + <property name="formView" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}SearchForm" /> + <property name="commandName" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}" /> + <property name="commandClass" value="${pckName}.pojo.${jdoInfo.javaClassName}" /> + </bean> + +#end + <!-- Spring MVC configuration --> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="ApplicationResources" /> @@ -37,6 +80,15 @@ #foreach($jdoInfo in ${jdoInfos}) <prop key="/list${jdoInfo.javaClassName}.html">${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}ListController</prop> #end +#foreach($jdoInfo in ${jdoInfos}) + <prop key="/addupdate${jdoInfo.javaClassName}.html">${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}AddUpdateController</prop> +#end +#foreach($jdoInfo in ${jdoInfos}) + <prop key="/delete${jdoInfo.javaClassName}.html">${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}AjaxDeleteController</prop> +#end +#foreach($jdoInfo in ${jdoInfos}) + <prop key="/search${jdoInfo.javaClassName}.html">${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}SearchController</prop> +#end </props> </property> </bean> Added: salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/addupdatecontroller.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,113 @@ +package ${jdoInfo.javaPckName}.webapp.controller; + +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +import java.util.Map; +import org.springframework.ui.ModelMap; +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +import ${jdoInfo.javaPckName}.${colfk2.pkJavaClassName}DAO; +#end +#end + +#end +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.servlet.mvc.CancellableFormController; +import org.springframework.web.bind.ServletRequestDataBinder; + +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; + +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +import ${jdoInfo.javaPckName}.pojo.${colfk2.pkJavaClassName}; +import ${jdoInfo.javaPckName}.webapp.editor.${colfk2.pkJavaClassName}EditorSupport; +#end +#end + +/** + * <p>Spring controller to add or update a ${jdoInfo.javaClassName}</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}AddUpdateController extends CancellableFormController { + + private ${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + private ${colfk2.pkJavaClassName}DAO ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + + public void set${colfk2.pkJavaClassName}DAO(${colfk2.pkJavaClassName}DAO ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO = ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + } + + public ${colfk2.pkJavaClassName}DAO get${colfk2.pkJavaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + } + +#end +#end + public void set${jdoInfo.javaClassName}DAO(${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + public ${jdoInfo.javaClassName}DAO get${jdoInfo.javaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) + @Override + protected Map referenceData(HttpServletRequest request) throws Exception { + ModelMap modelMap = new ModelMap(); +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + modelMap.addObject("${colfk2.pkJavaClassName}s", ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO.findAll()); +#end +#end + return modelMap; + } + +#end + /* + * (non-Javadoc) + * + * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest) + */ + @Override + protected Object formBackingObject(HttpServletRequest request) throws Exception { + + ${jdoInfo.javaClassName} ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = null; + if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); + } else { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = new ${jdoInfo.javaClassName}(); + } + + return ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}; + } + + @Override + protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { + + super.initBinder(request, binder); +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + binder.registerCustomEditor(${colfk2.pkJavaClassName}.class, new ${colfk2.pkJavaClassName}EditorSupport()); +#end +#end + + } + + /* + * (non-Javadoc) + * + * @see org.springframework.web.servlet.mvc.SimpleFormController#doSubmitAction(java.lang.Object) + */ + @Override + protected void doSubmitAction(Object command) throws Exception { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.saveOrUpdate((${jdoInfo.javaClassName}) command); + } + +} Added: salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/ajaxdeletecontroller.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,40 @@ +package ${jdoInfo.javaPckName}.webapp.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.AbstractController; + +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; + +/** + * <p>Spring controller to delete a ${jdoInfo.javaClassName}</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}AjaxDeleteController extends AbstractController { + + private ${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + + public void set${jdoInfo.javaClassName}DAO(${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + public ${jdoInfo.javaClassName}DAO get${jdoInfo.javaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + @Override + protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { + + if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.deleteById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); + } + + //TODO: when it will be ajax : return null; + return new ModelAndView("redirect:/list${jdoInfo.javaClassName}.html"); + } + +} Added: salto-db-generator/trunk/templates/springwebapp/editor.vm =================================================================== Added: salto-db-generator/trunk/templates/springwebapp/emlist.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/emlist.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/emlist.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,26 @@ +#if ($util.getLength($jdoInfo.pk) > 0) +#foreach($pk in $jdoInfo.pk) +#set ($pkEntry="entry.${pk.javaAttName}") +#end +#end +<c:if test="${ not empty ${jdoInfo.javaClassName}list}"> + <table> + <tr> +#foreach($col in ${jdoInfo.nonFKColInfos}) + <th>${col.javaAttName}</th> +#end + <th>Remove</th> + </tr> +<c:forEach items="${${jdoInfo.javaClassName}list}" var="entry"> + <tr> +#foreach($col in ${jdoInfo.nonFKColInfos}) +#set ($val = "entry.${col.javaAttName}") + <td><a href="addupdate${jdoInfo.javaClassName}.html?${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id=<c:out value="${${pkEntry}}" />"><c:out value="${${val}}" /></a></td> +#end + <td> + <a href="#" onclick="remove${jdoInfo.javaClassName}(<c:out value="${${pkEntry}})"/>">X</a> + </td> + </tr> +</c:forEach> + </table> +</c:if> \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/form.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/form.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/form.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,46 @@ +<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +#if ($util.getLength($jdoInfo.pk) > 0) +#foreach($pk in $jdoInfo.pk) +#set ($pkEntry="${pk.javaAttName}") +#end +#end + <head> + </head> + <body> +<%@ include file="menu.jsp" %> + <form:form commandName="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}" action="addupdate${jdoInfo.javaClassName}.html" method="post"> + <ul> +#foreach($col in ${jdoInfo.nonFKColInfos}) + <li><label for="${col.javaAttName}">${col.javaAttName}</label><form:errors path="${col.javaAttName}" /><span><form:input path="${col.javaAttName}" id="${col.javaAttName}"/></span></li> +#end +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + <li><label for="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}">${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}</label> + <form:errors path="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}" /> + <span> + <form:select path="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}" id="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}"> + <!-- I don't see any way to know which column should be displayed to the user, so you need to do the job yourself here... --> + <form:options items="${${colfk2.pkJavaClassName}s}" itemValue="${colfk2.pkJavaAttName}" itemLabel="${colfk2.pkJavaAttName}"/> + </form:select> + </span> + </li> +#end +#end +<c:if test="${ empty requestScope['${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}'].$pkEntry}"> + <li><input type="submit" name="add" value="Add" /> <input type="submit" name="cancel" value="Cancel" /></li> +</c:if> +<c:if test="${ not empty requestScope['${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}'].$pkEntry}"> + <li><input type="submit" name="update" value="Update" /> <input type="submit" name="cancel" value="Cancel" /></li> +</c:if> + </ul> + </form:form> + </body> +</html> \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/index.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/index.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/index.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,16 @@ +<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + <head> + </head> + <body> + This webapp has been generated by ${generatorVersion} at $date. +<%@ include file="/WEB-INF/pages/menu.jsp" %> + </body> +</html> \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/list.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/list.jsp.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springwebapp/list.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -10,21 +10,18 @@ <head> <title><fmt:message key="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}List.title"/></title> </head> +<script language="javascript"> + +function remove${jdoInfo.javaClassName}(id) +{ +/* todo : ajax request with prototype*/ +document.location = 'delete${jdoInfo.javaClassName}.html?${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id='+id; +} + +</script> <body> +<%@ include file="menu.jsp" %> <h1>List of ${jdoInfo.javaClassName}s</h1> - <table> - <tr> -#foreach($col in ${jdoInfo.jdoColInfos}) - <th>${col.javaAttName}</th> -#end - </tr> -<c:forEach items="${${jdoInfo.javaClassName}list}" var="entry"> - <tr> -#foreach($col in ${jdoInfo.jdoColInfos}) - <td><c:out value="\$\{entry.${col.javaAttName}}" /></td> -#end - </tr> -</c:forEach> - </table> +<%@ include file="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}EmList.jsp" %> </body> </html> \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/listcontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/listcontroller.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springwebapp/listcontroller.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -6,7 +6,7 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.ParameterizableViewController; -import com.salto.pojodao.pojo.${jdoInfo.javaClassName}DAO; +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; /** * <p>Spring controller to diplay list of ${jdoInfo.javaClassName}s</p> Added: salto-db-generator/trunk/templates/springwebapp/log4j.properties.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/log4j.properties.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/log4j.properties.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,7 @@ +# This file has been generated by ${generatorVersion} at $date +log4j.rootCategory=info, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %-5p %-17c{2} (%30F:%L) %3x- %m%n + + Added: salto-db-generator/trunk/templates/springwebapp/menu.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/menu.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/menu.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,9 @@ +<div id="menu"> + <ul> +#foreach($jdoInfo in ${jdoInfos}) + <li><a href="addupdate${jdoInfo.javaClassName}.html">Add a ${jdoInfo.javaClassName}</a></li> + <li><a href="list${jdoInfo.javaClassName}.html">List ${jdoInfo.javaClassName}s</a></li> + <li><a href="search${jdoInfo.javaClassName}.html">Search ${jdoInfo.javaClassName}s</a></li> +#end + </ul> +</div> \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/searchcontroller.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,121 @@ +package ${jdoInfo.javaPckName}.webapp.controller; + +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +import java.util.Map; +import org.springframework.ui.ModelMap; +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +import ${jdoInfo.javaPckName}.${colfk2.pkJavaClassName}DAO; +#end +#end + +#end +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.bind.ServletRequestDataBinder; +import org.springframework.web.servlet.mvc.SimpleFormController; + +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; + +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +import ${jdoInfo.javaPckName}.pojo.${colfk2.pkJavaClassName}; +import ${jdoInfo.javaPckName}.webapp.editor.${colfk2.pkJavaClassName}EditorSupport; +#end +#end + +/** + * <p>Spring controller to search for ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}SearchController extends SimpleFormController { + + private ${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + private ${colfk2.pkJavaClassName}DAO ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + + public void set${colfk2.pkJavaClassName}DAO(${colfk2.pkJavaClassName}DAO ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO = ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + } + + public ${colfk2.pkJavaClassName}DAO get${colfk2.pkJavaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO; + } + +#end +#end + public void set${jdoInfo.javaClassName}DAO(${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + public ${jdoInfo.javaClassName}DAO get${jdoInfo.javaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) + @Override + protected Map referenceData(HttpServletRequest request) throws Exception { + ModelMap modelMap = new ModelMap(); +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + modelMap.addObject("${colfk2.pkJavaClassName}s", ${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}DAO.findAll()); +#end +#end + return modelMap; + } + +#end + /* + * (non-Javadoc) + * + * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest) + */ + @Override + protected Object formBackingObject(HttpServletRequest request) throws Exception { + + ${jdoInfo.javaClassName} ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = null; + if (request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id") != null) { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.getById(Integer.parseInt(request.getParameter("${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}Id"))); + } else { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})} = new ${jdoInfo.javaClassName}(); + } + + return ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}; + } + + /* (non-Javadoc) + * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException) + */ + @Override + protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException bindException) throws Exception { + + ModelAndView modelAndView = super.onSubmit(request, response, command, bindException); + + modelAndView.addObject("${jdoInfo.javaClassName}list", ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.findByExample((${jdoInfo.javaClassName}) command, new String[0])); + + modelAndView.addAllObjects(this.referenceData(request)); + + return modelAndView; + } + + @Override + protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { + + super.initBinder(request, binder); +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + binder.registerCustomEditor(${colfk2.pkJavaClassName}.class, new ${colfk2.pkJavaClassName}EditorSupport()); +#end +#end + + } + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/searchform.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/searchform.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/searchform.jsp.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -0,0 +1,43 @@ +<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +#if ($util.getLength($jdoInfo.pk) > 0) +#foreach($pk in $jdoInfo.pk) +#set ($pkEntry="${pk.javaAttName}") +#end +#end + <head> + </head> + <body> +<%@ include file="menu.jsp" %> + <h1>Search ${jdoInfo.javaClassName}s</h1> + <form:form commandName="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}" action="search${jdoInfo.javaClassName}.html" method="post"> + <ul> +#foreach($col in ${jdoInfo.nonFKColInfos}) + <li><label for="${col.javaAttName}">${col.javaAttName}</label><form:errors path="${col.javaAttName}" /><span><form:input path="${col.javaAttName}" id="${col.javaAttName}"/></span></li> +#end +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) + <li><label for="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}">${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}</label> + <form:errors path="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}" /> + <span> + <form:select path="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}" id="${util.DoNameCreator.class2attribute(${colfk2.pkJavaClassName})}"> + <!-- I don't see any way to know which column should be displayed to the user, so you need to do the job yourself here... --> + <form:options items="${${colfk2.pkJavaClassName}s}" itemValue="${colfk2.pkJavaAttName}" itemLabel="${colfk2.pkJavaAttName}"/> + </form:select> + </span> + </li> +#end +#end + <li id="buttons"><input type="submit" name="search" value="Search" /></li> + </ul> + </form:form> +<%@ include file="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}EmList.jsp" %> + </body> +</html> \ No newline at end of file Modified: salto-db-generator/trunk/templates/springwebapp/web.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/web.xml.vm 2007-04-05 09:28:05 UTC (rev 273) +++ salto-db-generator/trunk/templates/springwebapp/web.xml.vm 2007-04-05 09:29:17 UTC (rev 274) @@ -15,7 +15,7 @@ </context-param> <context-param> <param-name>contextConfigLocation</param-name> - <param-value>/WEB-INF/applicationContext-*.xml,/WEB-INF/security.xml</param-value> + <param-value>/WEB-INF/applicationContext-*.xml</param-value> </context-param> <filter> @@ -53,6 +53,10 @@ <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + <servlet> <servlet-name>action</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 09:28:06
|
Revision: 273 http://svn.sourceforge.net/salto-db/?rev=273&view=rev Author: rflament Date: 2007-04-05 02:28:05 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Added Paths: ----------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java 2007-04-05 09:28:05 UTC (rev 273) @@ -0,0 +1,37 @@ +package com.salto.db.generator.plugin; + +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author remi + * + */ +public final class HibernateDialectHelper { + + private static final Map dialects = new HashMap(); + + static { + dialects.put("Oracle", "org.hibernate.dialect.OracleDialect"); + dialects.put("Microsoft SQL Server", "org.hibernate.dialect.SQLServerDialect"); + // TODO: fill this map + } + + public final String getHibernateDialect(DatabaseMetaData metaData) throws SQLException { + if (metaData == null) + return null; + + + if (metaData.getDatabaseProductName().equals("MySQL")) { + if (metaData.getDatabaseMajorVersion() >= 5) { + return "org.hibernate.dialect.MySQL5Dialect"; + } + return "org.hibernate.dialect.MySQLDialect"; + } else + return (String) dialects.get(metaData.getDatabaseProductName()); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 09:27:29
|
Revision: 272 http://svn.sourceforge.net/salto-db/?rev=272&view=rev Author: rflament Date: 2007-04-05 02:27:28 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-04-05 09:27:28 UTC (rev 272) @@ -14,19 +14,6 @@ private boolean generateAnnotations = true; - private static final Map dialects = new HashMap(); - - static { - dialects.put("MySQL", "org.hibernate.dialect.MySQLDialect"); - dialects.put("Oracle", "org.hibernate.dialect.OracleDialect"); - dialects.put("Microsoft SQL Server", "org.hibernate.dialect.SQLServerDialect"); - // TODO: fill this map - } - - public static String getDialect(String dbProductName) { - return (String) dialects.get(dbProductName); - } - public boolean isGenerateAnnotations() { return generateAnnotations; } @@ -43,6 +30,7 @@ CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); context.put("jdoInfo", info); context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); context.put("generatorVersion", generator + " / " + this.getShortDescription()); @@ -84,6 +72,7 @@ context.put("dialect", this); context.put("pckName", pckName); context.put("annotations", String.valueOf(generateAnnotations)); + context.put("hibernateDialectHelper", new HibernateDialectHelper()); runVelocity(TEMPLATE_PATH, "hibernate.cfg.xml.vm", srcPath, "hibernate.cfg.xml", context); Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java 2007-04-05 09:27:28 UTC (rev 272) @@ -64,6 +64,7 @@ context.put("date", new Date()); context.put("dialect", this.ejb3Plugin); context.put("pckName", pckName); + context.put("hibernateDialectHelper", new HibernateDialectHelper()); context.put("annotations", String.valueOf(ejb3Plugin .isGenerateAnnotations())); runVelocity(TEMPLATE_PATH, "applicationContext-test.xml.vm", srcPath, Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java 2007-04-05 09:27:28 UTC (rev 272) @@ -76,6 +76,7 @@ context.put("pckName", pckName); context.put("annotations", String.valueOf(ejb3Plugin .isGenerateAnnotations())); + context.put("hibernateDialectHelper", new HibernateDialectHelper()); runVelocity(TEMPLATE_PATH, "springabstracthibernatedao.vm", srcPath + "/" + (pckName + ".hibernate").replace('.', '/') + "/", Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-04-05 09:27:28 UTC (rev 272) @@ -33,14 +33,25 @@ runVelocity(TEMPLATE_PATH, "listcontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "ListController.java", context); - runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/../webapp/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); + runVelocity(TEMPLATE_PATH, "addupdatecontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AddUpdateController.java", context); + runVelocity(TEMPLATE_PATH, "ajaxdeletecontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "AjaxDeleteController.java", context); + + runVelocity(TEMPLATE_PATH, "searchcontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "SearchController.java", context); + + runVelocity(TEMPLATE_PATH, "emlist.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "EmList.jsp", context); + + runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); + + runVelocity(TEMPLATE_PATH, "form.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "Form.jsp", context); + runVelocity(TEMPLATE_PATH, "searchform.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "SearchForm.jsp", context); + } public void postExecute(JdoInfo[] infos) throws Exception { - //plugin.srcPath += "/../webapp/WEB-INF/"; + // plugin.srcPath += "/../webapp/WEB-INF/"; plugin.postExecute(infos); - + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); Map context = new HashMap(); @@ -52,9 +63,15 @@ context.put("date", new Date()); context.put("dialect", this.plugin); context.put("pckName", pckName); + context.put("hibernateDialectHelper", new HibernateDialectHelper()); - runVelocity(TEMPLATE_PATH, "action-servlet.xml.vm", srcPath + "/../webapp/WEB-INF/", "action-servlet.xml", context); - runVelocity(TEMPLATE_PATH, "web.xml.vm", srcPath + "/../webapp/WEB-INF/", "web.xml", context); + runVelocity(TEMPLATE_PATH, "action-servlet.xml.vm", srcPath + "/../WebContent/WEB-INF/", "action-servlet.xml", context); + runVelocity(TEMPLATE_PATH, "web.xml.vm", srcPath + "/../WebContent/WEB-INF/", "web.xml", context); + runVelocity(TEMPLATE_PATH, "ApplicationResources.properties.vm", srcPath, "ApplicationResources.properties", context); + runVelocity(TEMPLATE_PATH, "index.jsp.vm", srcPath + "/../WebContent/", "index.jsp", context); + runVelocity(TEMPLATE_PATH, "menu.jsp.vm", srcPath + "/../WebContent/WEB-INF/pages", "menu.jsp", context); + runVelocity(TEMPLATE_PATH, "log4j.properties.vm", srcPath, "log4j.properties", context); + } public String getLongDescription() { @@ -72,7 +89,7 @@ public void init(String generator, String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); plugin = new SpringEJB3AndHibernateDAOAndTestCasesPlugin(); - plugin.init(generator, doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); + plugin.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); } } Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2007-04-05 09:27:28 UTC (rev 272) @@ -1,27 +1,35 @@ package salto.tool.jdo.data; +import java.util.ArrayList; + import salto.tool.jdo.util.DoNameCreator; import salto.tool.jdo.util.IDoNameCreator; +import salto.tool.sql.data.TableFK; import salto.tool.sql.data.TableInfo; /** - * Objet de donn�e correspondant � un attribut java d'une classe de type Dataobject - * Date de cr�ation : (18/10/01 06:37:36) + * Objet de donn�e correspondant � un attribut java d'une classe de type + * Dataobject Date de cr�ation : (18/10/01 06:37:36) + * * @author : E. Loiez */ -public class JdoInfo extends TableInfo implements Cloneable{ +public class JdoInfo extends TableInfo implements Cloneable { protected String javaPckName = null; + protected String javaClassName = null; + protected JdoColInfo[] jdoColInfos = null; - - //composant cr�ant les noms / ce composant doit �tre param�trable + + // composant cr�ant les noms / ce composant doit �tre param�trable protected static IDoNameCreator nameCreator = new DoNameCreator(); + /** * Commentaire relatif au constructeur JdoInfo. */ public JdoInfo() { super(); } + /** * Commentaire relatif au constructeur JdoInfo. */ @@ -34,15 +42,84 @@ } } } + /** * @return Returns the javaClassName. */ public String getJavaClassName() { - if (javaClassName == null) nameCreator.createDoName(tableName); + if (javaClassName == null) + nameCreator.createDoName(tableName); return javaClassName; } /** + * colinfos that are not pk and not fk + * + * @return + */ + public JdoColInfo[] getBasicColInfos() { + ArrayList list = new ArrayList(); + + for (int i = 0; i < jdoColInfos.length; i++) { + boolean basic = true; + + for (int j = 0; j < this.pk.length && basic; j++) { + if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { + basic = false; + } + + } + + for (int j = 0; j < this.getImportedFk().length && basic; j++) { + TableFK[] fks = this.getImportedFk()[j]; + + for (int k = 0; k < fks.length; k++) { + if (fks[k].getFkColumnName().equals(jdoColInfos[i].getColName())) { + basic = false; + } + } + + } + + if (basic) { + list.add(jdoColInfos[i]); + } + } + + return (JdoColInfo[]) list.toArray(new JdoColInfo[list.size()]); + } + + /** + * colinfos that are not fk + * + * @return + */ + public JdoColInfo[] getNonFKColInfos() { + ArrayList list = new ArrayList(); + + for (int i = 0; i < jdoColInfos.length; i++) { + boolean basic = true; + + for (int j = 0; j < this.getImportedFk().length && basic; j++) { + TableFK[] fks = this.getImportedFk()[j]; + + for (int k = 0; k < fks.length; k++) { + if (fks[k].getFkColumnName().equals(jdoColInfos[i].getColName())) { + basic = false; + } + } + + } + + if (basic) { + list.add(jdoColInfos[i]); + } + } + + return (JdoColInfo[]) list.toArray(new JdoColInfo[list.size()]); + } + + /** * @return Returns the jdoColInfos. */ public JdoColInfo[] getJdoColInfos() { @@ -50,14 +127,16 @@ } /** - * @param jdoColInfos The jdoColInfos to set. + * @param jdoColInfos + * The jdoColInfos to set. */ public void setJdoColInfos(JdoColInfo[] jdoColInfos) { this.jdoColInfos = jdoColInfos; } /** - * @param javaClassName The javaClassName to set. + * @param javaClassName + * The javaClassName to set. */ public void setJavaClassName(String javaClassName) { this.javaClassName = javaClassName; @@ -71,13 +150,16 @@ } /** - * @param javaPckName The javaPckName to set. + * @param javaPckName + * The javaPckName to set. */ public void setJavaPckName(String javaPckName) { this.javaPckName = javaPckName; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#clone() */ protected Object clone() throws CloneNotSupportedException { Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java 2007-04-05 09:27:28 UTC (rev 272) @@ -1,5 +1,7 @@ package salto.tool.sql.data; +import salto.tool.jdo.util.CreatorUtil; + /** * Ins�rez la description du type � cet endroit. Date de cr�ation : (3/02/01 * 11:30:41) @@ -29,6 +31,8 @@ String fkName; + private String javaAttName; + /** * Commentaire relatif au constructeur TableFK. */ @@ -113,7 +117,7 @@ * @return java.lang.String */ public java.lang.String getPkName() { - + return pkName; } @@ -268,5 +272,17 @@ pkTableShem = newPkTableShem; } + /** + * @return Returns the javaAttName. + */ + public String getPkJavaAttName() { + if (javaAttName == null) + javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(pkColumnName); + return javaAttName; + } + public String getPkJavaClassName() { + return CreatorUtil.getDoNameCreator().createDoName(pkTableName); + } + } \ No newline at end of file Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java 2007-04-05 09:26:40 UTC (rev 271) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java 2007-04-05 09:27:28 UTC (rev 272) @@ -1,8 +1,10 @@ package salto.tool.sql.data; +import salto.tool.jdo.util.CreatorUtil; + /** - * Descriptionde la cl\xE9 primaire d'une table. - * Date de cr\xE9ation : (10/02/01 11:32:02) + * Descriptionde la cl� primaire d'une table. + * Date de cr�ation : (10/02/01 11:32:02) * @author : Administrator */ public class TablePK { @@ -19,6 +21,8 @@ private String table=null; private String col=null; + private String javaAttName; + /** * Commentaire relatif au constructeur TablePK. */ @@ -26,64 +30,64 @@ super(); } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @return java.lang.String */ public java.lang.String getCat() { return cat; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @return java.lang.String */ public java.lang.String getCol() { return col; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @return java.lang.String */ public java.lang.String getShem() { return shem; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @return java.lang.String */ public java.lang.String getTable() { return table; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @param newCat java.lang.String */ public void setCat(java.lang.String newCat) { cat = newCat; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @param newCol java.lang.String */ public void setCol(java.lang.String newCol) { col = newCol; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @param newShem java.lang.String */ public void setShem(java.lang.String newShem) { shem = newShem; } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (10/02/01 11:35:13) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (10/02/01 11:35:13) * @param newTable java.lang.String */ public void setTable(java.lang.String newTable) { @@ -94,8 +98,8 @@ private String pkName = null; /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (30/09/01 10:47:17) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (30/09/01 10:47:17) * @return short */ public short getKeySeq() { @@ -103,8 +107,8 @@ } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (30/09/01 10:47:17) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (30/09/01 10:47:17) * @return java.lang.String */ public java.lang.String getPkName() { @@ -112,8 +116,8 @@ } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (30/09/01 10:47:17) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (30/09/01 10:47:17) * @param newKeySeq short */ public void setKeySeq(short newKeySeq) { @@ -121,11 +125,21 @@ } /** - * Ins\xE9rez la description de la m\xE9thode \xE0 cet endroit. - * Date de cr\xE9ation : (30/09/01 10:47:17) + * Ins�rez la description de la m�thode � cet endroit. + * Date de cr�ation : (30/09/01 10:47:17) * @param newPkName java.lang.String */ public void setPkName(java.lang.String newPkName) { pkName = newPkName; } + + +/** + * @return Returns the javaAttName. + */ +public String getJavaAttName() { + if (javaAttName == null) + javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(col); + return javaAttName; +} } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-04-05 09:26:43
|
Revision: 271 http://svn.sourceforge.net/salto-db/?rev=271&view=rev Author: rflament Date: 2007-04-05 02:26:40 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java 2007-03-26 19:37:09 UTC (rev 270) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3AndHibernateDAOPlugin.java 2007-04-05 09:26:40 UTC (rev 271) @@ -77,6 +77,7 @@ context.put("date", new Date()); context.put("dialect", this.ejb3Plugin); context.put("pckName", pckName); + context.put("hibernateDialectHelper", new HibernateDialectHelper()); context.put("annotations", String.valueOf(ejb3Plugin.isGenerateAnnotations())); runVelocity(TEMPLATE_PATH, "hibernatedaofactory.vm", srcPath + "/" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-26 19:37:12
|
Revision: 270 http://svn.sourceforge.net/salto-db/?rev=270&view=rev Author: rflament Date: 2007-03-26 12:37:09 -0700 (Mon, 26 Mar 2007) Log Message: ----------- dialect for sql server Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-03-11 12:33:09 UTC (rev 269) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/EJB3Plugin.java 2007-03-26 19:37:09 UTC (rev 270) @@ -19,6 +19,7 @@ static { dialects.put("MySQL", "org.hibernate.dialect.MySQLDialect"); dialects.put("Oracle", "org.hibernate.dialect.OracleDialect"); + dialects.put("Microsoft SQL Server", "org.hibernate.dialect.SQLServerDialect"); // TODO: fill this map } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-11 12:33:18
|
Revision: 269 http://svn.sourceforge.net/salto-db/?rev=269&view=rev Author: rflament Date: 2007-03-11 05:33:09 -0700 (Sun, 11 Mar 2007) Log Message: ----------- doc Modified Paths: -------------- salto-db-generator/trunk/src/site/apt/index.apt salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt salto-db-generator/trunk/src/site/apt/plugins/hibernate.apt salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt Modified: salto-db-generator/trunk/src/site/apt/index.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/index.apt 2007-03-11 12:32:44 UTC (rev 268) +++ salto-db-generator/trunk/src/site/apt/index.apt 2007-03-11 12:33:09 UTC (rev 269) @@ -12,4 +12,6 @@ Salto-db Generator connects to a database thanks to jdbc, parses the tables structures and executes a plugin. A plugin can do anything with the tables structures. Built-in plugins generate java code to access data with different ORMs from a java application. Have a look at the different plugins descriptions for more informations. - Salto-db Generator can be run from Ant or as an Eclipse plugin. \ No newline at end of file + Salto-db Generator can be run from Ant or as an Eclipse plugin. + + Latest version is v1.0.16 \ No newline at end of file Modified: salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt 2007-03-11 12:32:44 UTC (rev 268) +++ salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt 2007-03-11 12:33:09 UTC (rev 269) @@ -53,12 +53,13 @@ of the city they live in : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); List<Person> persons = DAOFactory.DEFAULT.buildPersonDAO().findAll(); for (Person person : persons) { System.out.println(person.getFirstName()+" "+person.getName()+" lives in "+person.getCity().getName()); } - +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ @@ -133,6 +134,17 @@ public static final DAOFactory DEFAULT = HIBERNATE; + /** + * Factory method for instantiation of concrete factories. + */ + public static DAOFactory instance(Class factory) { + try { + return (DAOFactory)factory.newInstance(); + } catch (Exception ex) { + throw new RuntimeException("Couldn't create DAOFactory: " + factory); + } + } + public abstract CityDAO buildCityDAO(); public abstract PersonDAO buildPersonDAO(); @@ -243,35 +255,63 @@ +----------------------------------------------------------+ package com.salto.ejb3dao.hibernate; -import com.salto.ejb3dao.GenericDAO; +import com.GenericDAO; import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import org.hibernate.Criteria; import org.hibernate.FlushMode; import org.hibernate.Query; import org.hibernate.LockMode; import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Example; /** - * Generated at Tue Feb 06 11:15:11 CET 2007 + * Generated at Sat Mar 03 20:24:04 CET 2007 * - * @author Salto-db Generator Ant v1.0.15 / EJB3 + Hibernate DAO + * @author Salto-db Generator Ant v1.0.16 / EJB3 + Hibernate DAO + * @see http://www.hibernate.org/328.html */ public abstract class AbstractHibernateDAO<T, ID extends Serializable> implements GenericDAO<T, ID> { private Session session; - public AbstractHibernateDAO(Session s) { - session = s; + private Class<T> persistentClass; + + public AbstractHibernateDAO() { + this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } - - public Session getSession() { - return session; - } + protected Session getSession() { + if (session == null) + session = HibernateUtil.getSessionFactory().getCurrentSession(); + return session; + } + + public Class<T> getPersistentClass() { + return persistentClass; + } + public void setSession(Session session) { this.session = session; } + @SuppressWarnings("unchecked") + public T getById(ID id) { + return (T) getSession().get(getPersistentClass(), id); + } + + @SuppressWarnings("unchecked") + public T getById(ID id, boolean lock) { + if (lock) { + return (T) getSession().get(getPersistentClass(), id, + LockMode.UPGRADE); + } else + return getById(id); + } + public void save(T entity) { getSession().save(entity); } @@ -295,10 +335,27 @@ delete(entity); } + @SuppressWarnings("unchecked") + public List<T> findAll() { + return findByCriteria(); + } + /** + * Use this inside subclasses as a convenience method. + */ + @SuppressWarnings("unchecked") + protected List<T> findByCriteria(Criterion... criterion) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } + + /** * This method will execute an HQL query and return the number of affected entities. */ - protected int executeQuery(String query, String namedParams[], Object params[]) { + protected int executeQuery(String query, String namedParams[], Object params[]) { Query q = getSession().createQuery(query); if (namedParams != null) { @@ -317,7 +374,7 @@ /** * This method will execute a Named HQL query and return the number of affected entities. */ - protected int executeNamedQuery(String namedQuery, String namedParams[], Object params[]) { + protected int executeNamedQuery(String namedQuery, String namedParams[], Object params[]) { Query q = getSession().getNamedQuery(namedQuery); if (namedParams != null) { @@ -333,6 +390,17 @@ return executeNamedQuery(namedQuery, null, null); } + @SuppressWarnings("unchecked") + public List<T> findByExample(T exampleInstance, String[] excludeProperty) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + Example example = Example.create(exampleInstance); + for (String exclude : excludeProperty) { + example.excludeProperty(exclude); + } + crit.add(example); + return crit.list(); + } + } +----------------------------------------------------------+ @@ -363,22 +431,6 @@ public class CityHibernateDAO extends AbstractHibernateDAO<City, Integer> implements CityDAO { - - public CityHibernateDAO(Session s) { - super(s); - } - - public City getById(Integer id) { - return (City) getSession().get(City.class, id); - } - - public City getById(Integer id, boolean lock) { - if (lock) { - return (City) getSession().get(City.class, id, - LockMode.UPGRADE); - } else - return getById(id); - } /** * Find City by criteria. @@ -413,13 +465,6 @@ return q.executeUpdate(); } - @SuppressWarnings("unchecked") - public List<City> findAll() { - Query q = getSession().createQuery("from City"); - q.setCacheable(true); - return q.list(); - } - /** * Find City by name */ @@ -448,7 +493,7 @@ * Generated at Tue Feb 06 11:15:11 CET 2007 * * @see http://www.hibernate.org/43.html - * @author Salto-db Generator Ant v1.0.15 / EJB3 + Hibernate DAO + * @author Salto-db Generator Ant v1.0.16 / EJB3 + Hibernate DAO */ public class HibernateDAOFactory extends DAOFactory { @@ -457,7 +502,7 @@ */ @Override public CityDAO buildCityDAO() { - return new CityHibernateDAO(HibernateUtil.getSession()); + return new CityHibernateDAO(); } /* (non-Javadoc) @@ -465,7 +510,7 @@ */ @Override public PersonDAO buildPersonDAO() { - return new PersonHibernateDAO(HibernateUtil.getSession()); + return new PersonHibernateDAO(); } } @@ -476,24 +521,19 @@ +----------------------------------------------------------+ package com.salto.ejb3dao.hibernate; -import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.AnnotationConfiguration; /** - * Generated at Tue Feb 06 11:15:11 CET 2007 + * Generated at Sat Mar 03 20:24:04 CET 2007 * - * @author Salto-db Generator Ant v1.0.15 / EJB3 + Hibernate DAO + * @author Salto-db Generator Ant v1.0.16 / EJB3 + Hibernate DAO */ public final class HibernateUtil { private static SessionFactory sessionFactory; - private static final ThreadLocal threadSession = new ThreadLocal(); - - private static final ThreadLocal threadTransaction = new ThreadLocal(); - static { try { sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); @@ -516,91 +556,8 @@ return sessionFactory; } - /** - * Retrieves the current Session local to the thread. <p/> If no Session is - * open, opens a new Session for the running thread. - * - * @return Session - */ - @SuppressWarnings("unchecked") - public static Session getSession() { - Session s = (Session) threadSession.get(); - - if (s == null) { - - s = getSessionFactory().openSession(); - - threadSession.set(s); - beginTransaction(); - } - - return s; - } - - /** - * Closes the Session local to the thread. - */ - @SuppressWarnings("unchecked") - public static void closeSession() { - - Session s = (Session) threadSession.get(); - threadSession.set(null); - if (s != null && s.isOpen()) { - - s.close(); - } - - } - - /** - * Start a new database transaction. - */ - @SuppressWarnings("unchecked") - public static void beginTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx == null) { - - tx = getSession().beginTransaction(); - threadTransaction.set(tx); - } - - } - - /** - * Commit the database transaction. - */ - @SuppressWarnings("unchecked") - public static void commitTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.commit(); - } - threadTransaction.set(null); - - } - - /** - * Rollback the database transaction. - */ - @SuppressWarnings("unchecked") - public static void rollbackTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - try { - threadTransaction.set(null); - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.rollback(); - } - - } finally { - closeSession(); - } - } - } + +----------------------------------------------------------+ * com.salto.ejb3dao.hibernate.PersonHibernateDAO : the Hibernate implementation of PersonDAO @@ -625,27 +582,11 @@ * <p>Hibernate DAO layer for Persons</p> * <p>Generated at Tue Feb 06 11:15:11 CET 2007</p> * - * @author Salto-db Generator Ant v1.0.15 / EJB3 + Hibernate DAO + * @author Salto-db Generator Ant v1.0.16 / EJB3 + Hibernate DAO */ public class PersonHibernateDAO extends AbstractHibernateDAO<Person, Integer> implements PersonDAO { - - public PersonHibernateDAO(Session s) { - super(s); - } - - public Person getById(Integer id) { - return (Person) getSession().get(Person.class, id); - } - - public Person getById(Integer id, boolean lock) { - if (lock) { - return (Person) getSession().get(Person.class, id, - LockMode.UPGRADE); - } else - return getById(id); - } /** * Find Person by criteria. @@ -693,13 +634,6 @@ return q.executeUpdate(); } - @SuppressWarnings("unchecked") - public List<Person> findAll() { - Query q = getSession().createQuery("from Person"); - q.setCacheable(true); - return q.list(); - } - /** * Find Person by name */ @@ -778,7 +712,7 @@ * <p></p> * * <p>Generated at Tue Feb 06 11:15:10 CET 2007</p> - * @author Salto-db Generator Ant v1.0.15 / EJB3 + * @author Salto-db Generator Ant v1.0.16 / EJB3 * */ @Entity @@ -883,7 +817,7 @@ * <p></p> * * <p>Generated at Tue Feb 06 11:15:11 CET 2007</p> - * @author Salto-db Generator Ant v1.0.15 / EJB3 + * @author Salto-db Generator Ant v1.0.16 / EJB3 * */ @Entity @@ -1022,6 +956,10 @@ <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.password">XXXXXXXX</property> <property name="show_sql">true</property> + + <!-- Remove this property if you use JTA --> + <property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property> + <mapping class="com.salto.ejb3dao.pojo.City" /> <mapping class="com.salto.ejb3dao.pojo.Person" /> @@ -1036,29 +974,37 @@ Retrieve every persons in database : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); List<Person> persons = DAOFactory.DEFAULT.buildPersonDAO().findAll(); +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ Retrieve every persons that lives in a "Paris" : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); City paris = DAOFactory.DEFAULT.buildCityDAO().findByName("Paris"); List<Person> parisCitizen = paris.getPersons(); // if you know what Paris's id is, you can use this code : // List<Person> parisCitizen = DAOFactory.DEFAULT.buildPersonDAO().findByIdCity(parisId); +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ Save a new Person in database : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); + Person person = new Person(); person.setName("doe"); person.setFirstName("john"); person.setAge(20); DAOFactory.DEFAULT.buildPersonDAO().save(person); + +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ As you can see, thanks to Hibernate and to the generic dao pattern, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can - focus on business logic instead of loosing time managing connections, transactions and so on. \ No newline at end of file + focus on business logic instead of loosing time managing connections, transactions and so on. Have a look at the Open session in view pattern for more informations : {{http://www.hibernate.org/43.html}}. \ No newline at end of file Modified: salto-db-generator/trunk/src/site/apt/plugins/hibernate.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/hibernate.apt 2007-03-11 12:32:44 UTC (rev 268) +++ salto-db-generator/trunk/src/site/apt/plugins/hibernate.apt 2007-03-11 12:33:09 UTC (rev 269) @@ -319,7 +319,11 @@ <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.password">XXXXXXXXX</property> <property name="show_sql">true</property> + + <!-- Remove this property if you use JTA --> + <property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property> + <mapping resource="City.hbm.xml" /> <mapping resource="Person.hbm.xml" /> Modified: salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt 2007-03-11 12:32:44 UTC (rev 268) +++ salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt 2007-03-11 12:33:09 UTC (rev 269) @@ -55,6 +55,7 @@ of the city they live in : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); List<Person> persons = DAOFactory.DEFAULT.buildPersonDAO().findAll(); for (Person person : persons) { @@ -125,7 +126,7 @@ * Generated at Thu Feb 15 16:29:39 CET 2007 * * @see http://www.hibernate.org/328.html - * @author Salto-db Generator Ant v1.0.15 / Pojos + Hibernate mapping + Generic DAO + * @author Salto-db Generator Ant v1.0.16 / Pojos + Hibernate mapping + Generic DAO */ public abstract class DAOFactory { @@ -134,6 +135,17 @@ public static final DAOFactory DEFAULT = HIBERNATE; + /** + * Factory method for instantiation of concrete factories. + */ + public static DAOFactory instance(Class factory) { + try { + return (DAOFactory)factory.newInstance(); + } catch (Exception ex) { + throw new RuntimeException("Couldn't create DAOFactory: " + factory); + } + } + public abstract CityDAO buildCityDAO(); public abstract PersonDAO buildPersonDAO(); @@ -239,40 +251,69 @@ ** Hibernate implementation - * com.salto.pojodao.hibernate.AbstractHibernateDAO : an abstract hibernate implementation of GenericDAO + * com.salto.pojodao.hibernate.AbstractHibernateDAO : an abstract hibernate implementation of GenericDAO +----------------------------------------------------------+ package com.salto.pojodao.hibernate; -import com.salto.pojodao.GenericDAO; + +import com.GenericDAO; import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import org.hibernate.Criteria; import org.hibernate.FlushMode; import org.hibernate.Query; import org.hibernate.LockMode; import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Example; /** - * Generated at Thu Feb 15 16:29:39 CET 2007 + * Generated at Sat Mar 03 20:24:04 CET 2007 * - * @author Salto-db Generator Ant v1.0.15 / Pojos + Hibernate mapping + Generic DAO + * @author Salto-db Generator Ant v1.0.16 / EJB3 + Hibernate DAO + * @see http://www.hibernate.org/328.html */ public abstract class AbstractHibernateDAO<T, ID extends Serializable> implements GenericDAO<T, ID> { private Session session; - public AbstractHibernateDAO(Session s) { - session = s; + private Class<T> persistentClass; + + public AbstractHibernateDAO() { + this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } - - public Session getSession() { - return session; - } + protected Session getSession() { + if (session == null) + session = HibernateUtil.getSessionFactory().getCurrentSession(); + return session; + } + + public Class<T> getPersistentClass() { + return persistentClass; + } + public void setSession(Session session) { this.session = session; } + @SuppressWarnings("unchecked") + public T getById(ID id) { + return (T) getSession().get(getPersistentClass(), id); + } + + @SuppressWarnings("unchecked") + public T getById(ID id, boolean lock) { + if (lock) { + return (T) getSession().get(getPersistentClass(), id, + LockMode.UPGRADE); + } else + return getById(id); + } + public void save(T entity) { getSession().save(entity); } @@ -296,7 +337,24 @@ delete(entity); } + @SuppressWarnings("unchecked") + public List<T> findAll() { + return findByCriteria(); + } + /** + * Use this inside subclasses as a convenience method. + */ + @SuppressWarnings("unchecked") + protected List<T> findByCriteria(Criterion... criterion) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } + + /** * This method will execute an HQL query and return the number of affected entities. */ protected int executeQuery(String query, String namedParams[], Object params[]) { @@ -334,6 +392,17 @@ return executeNamedQuery(namedQuery, null, null); } + @SuppressWarnings("unchecked") + public List<T> findByExample(T exampleInstance, String[] excludeProperty) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + Example example = Example.create(exampleInstance); + for (String exclude : excludeProperty) { + example.excludeProperty(exclude); + } + crit.add(example); + return crit.list(); + } + } +----------------------------------------------------------+ @@ -364,22 +433,6 @@ public class CityHibernateDAO extends AbstractHibernateDAO<City, Integer> implements CityDAO { - - public CityHibernateDAO(Session s) { - super(s); - } - - public City getById(Integer id) { - return (City) getSession().get(City.class, id); - } - - public City getById(Integer id, boolean lock) { - if (lock) { - return (City) getSession().get(City.class, id, - LockMode.UPGRADE); - } else - return getById(id); - } /** * Find City by criteria. @@ -450,7 +503,7 @@ * Generated at Thu Feb 15 16:29:39 CET 2007 * * @see http://www.hibernate.org/43.html - * @author Salto-db Generator Ant v1.0.15 / Pojos + Hibernate mapping + Generic DAO + * @author Salto-db Generator Ant v1.0.16 / Pojos + Hibernate mapping + Generic DAO */ public class HibernateDAOFactory extends DAOFactory { @@ -459,7 +512,7 @@ */ @Override public CityDAO buildCityDAO() { - return new CityHibernateDAO(HibernateUtil.getSession()); + return new CityHibernateDAO(); } /* (non-Javadoc) @@ -467,7 +520,7 @@ */ @Override public PersonDAO buildPersonDAO() { - return new PersonHibernateDAO(HibernateUtil.getSession()); + return new PersonHibernateDAO(); } } @@ -486,16 +539,12 @@ /** * Generated at Thu Feb 15 16:29:39 CET 2007 * - * @author Salto-db Generator Ant v1.0.15 / Pojos + Hibernate mapping + Generic DAO + * @author Salto-db Generator Ant v1.0.16 / Pojos + Hibernate mapping + Generic DAO */ public final class HibernateUtil { private static SessionFactory sessionFactory; - private static final ThreadLocal threadSession = new ThreadLocal(); - - private static final ThreadLocal threadTransaction = new ThreadLocal(); - static { try { sessionFactory = new Configuration().configure().buildSessionFactory(); @@ -518,90 +567,6 @@ return sessionFactory; } - /** - * Retrieves the current Session local to the thread. <p/> If no Session is - * open, opens a new Session for the running thread. - * - * @return Session - */ - @SuppressWarnings("unchecked") - public static Session getSession() { - Session s = (Session) threadSession.get(); - - if (s == null) { - - s = getSessionFactory().openSession(); - - threadSession.set(s); - beginTransaction(); - } - - return s; - } - - /** - * Closes the Session local to the thread. - */ - @SuppressWarnings("unchecked") - public static void closeSession() { - - Session s = (Session) threadSession.get(); - threadSession.set(null); - if (s != null && s.isOpen()) { - - s.close(); - } - - } - - /** - * Start a new database transaction. - */ - @SuppressWarnings("unchecked") - public static void beginTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx == null) { - - tx = getSession().beginTransaction(); - threadTransaction.set(tx); - } - - } - - /** - * Commit the database transaction. - */ - @SuppressWarnings("unchecked") - public static void commitTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.commit(); - } - threadTransaction.set(null); - - } - - /** - * Rollback the database transaction. - */ - @SuppressWarnings("unchecked") - public static void rollbackTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - try { - threadTransaction.set(null); - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.rollback(); - } - - } finally { - closeSession(); - } - } - } +----------------------------------------------------------+ @@ -626,29 +591,12 @@ * <p>Hibernate DAO layer for Persons</p> * <p>Generated at Thu Feb 15 16:29:39 CET 2007</p> * - * @author Salto-db Generator Ant v1.0.15 / Pojos + Hibernate mapping + Generic DAO + * @author Salto-db Generator Ant v1.0.16 / Pojos + Hibernate mapping + Generic DAO */ public class PersonHibernateDAO extends AbstractHibernateDAO<Person, Integer> implements PersonDAO { - - public PersonHibernateDAO(Session s) { - super(s); - } - - public Person getById(Integer id) { - return (Person) getSession().get(Person.class, id); - } - - public Person getById(Integer id, boolean lock) { - if (lock) { - return (Person) getSession().get(Person.class, id, - LockMode.UPGRADE); - } else - return getById(id); - } - /** * Find Person by criteria. * If a parameter is null it is not used in the query. @@ -695,13 +643,6 @@ return q.executeUpdate(); } - @SuppressWarnings("unchecked") - public List<Person> findAll() { - Query q = getSession().createQuery("from Person"); - q.setCacheable(true); - return q.list(); - } - /** * Find Person by name */ @@ -976,7 +917,11 @@ <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.password">XXXXXXXX</property> <property name="show_sql">true</property> + + <!-- Remove this property if you use JTA --> + <property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property> + <mapping resource="City.hbm.xml" /> <mapping resource="Person.hbm.xml" /> @@ -1044,29 +989,37 @@ Retrieve every persons in database : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); List<Person> persons = DAOFactory.DEFAULT.buildPersonDAO().findAll(); +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ Retrieve every persons that lives in a "Paris" : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); City paris = DAOFactory.DEFAULT.buildCityDAO().findByName("Paris"); List<Person> parisCitizen = paris.getPersons(); // if you know what Paris's id is, you can use this code : // List<Person> parisCitizen = DAOFactory.DEFAULT.buildPersonDAO().findByIdCity(parisId); +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ Save a new Person in database : +--------------------------------------------------------------+ +// jdbc : Transaction t = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); + Person person = new Person(); person.setName("doe"); person.setFirstName("john"); person.setAge(20); DAOFactory.DEFAULT.buildPersonDAO().save(person); + +// jdbc: commit transaction and handle exceptions +--------------------------------------------------------------+ As you can see, thanks to Hibernate and to the generic dao pattern, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can - focus on business logic instead of loosing time managing connections, transactions and so on. \ No newline at end of file + focus on business logic instead of loosing time managing connections, transactions and so on. Have a look at the Open session in view pattern for more informations : {{http://www.hibernate.org/43.html}}. \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-11 12:32:50
|
Revision: 268 http://svn.sourceforge.net/salto-db/?rev=268&view=rev Author: rflament Date: 2007-03-11 05:32:44 -0700 (Sun, 11 Mar 2007) Log Message: ----------- v1.0.16 Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/Constants.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/Constants.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2007-03-09 15:34:43 UTC (rev 267) +++ salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2007-03-11 12:32:44 UTC (rev 268) @@ -10,5 +10,5 @@ } - public static final String VERSION = "v1.0.15"; + public static final String VERSION = "v1.0.16"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-09 15:34:58
|
Revision: 267 http://svn.sourceforge.net/salto-db/?rev=267&view=rev Author: rflament Date: 2007-03-09 07:34:43 -0800 (Fri, 09 Mar 2007) Log Message: ----------- spring plugins Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java salto-db-generator/trunk/src/plugins.xml Added Paths: ----------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-03-09 15:32:52 UTC (rev 266) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2007-03-09 15:34:43 UTC (rev 267) @@ -3,6 +3,7 @@ import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -44,7 +45,7 @@ private String password; - private String tableName; + private String tablesNames; private String schema; @@ -84,11 +85,22 @@ connectionInfo.setConn(defaultConn); log("Successfully connected to database"); - TableInfo[] tableInfos = DatabaseInfo.getTables(defaultConn, null, - schema, tableName); - log(tableInfos.length + " table(s) found for table name '" - + tableName + "'"); + String tableNames[] = tablesNames.split(","); + + ArrayList list = new ArrayList(); + for (int k = 0; k < tableNames.length; k++) { + TableInfo[] tableInfos = DatabaseInfo.getTables(defaultConn, + null, schema, tableNames[k]); + log(tableInfos.length + " table(s) found for table name '" + + tableNames[k] + "'"); + + list.addAll(Arrays.asList(tableInfos)); + } + + TableInfo[] tableInfos = (TableInfo[]) list + .toArray(new TableInfo[list.size()]); + IGeneratorPlugin p = Plugins.getInstance().getPlugin(plugin); if (p == null) { throw new Exception("Cannot find plugin " + plugin); @@ -161,6 +173,7 @@ + outputDir, packageName, (JdoInfo[]) jdoInfos .toArray(new JdoInfo[jdoInfos.size()]), tmpl); } + } catch (Exception e) { log(e.getMessage()); throw new BuildException(e); @@ -189,12 +202,12 @@ log("-----------------------------------------"); } - public String getTableName() { - return tableName; + public String getTablesNames() { + return tablesNames; } - public void setTableName(String tableName) { - this.tableName = tableName; + public void setTablesNames(String tablesNames) { + this.tablesNames = tablesNames; } public String getJdbcUrl() { Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java 2007-03-09 15:32:52 UTC (rev 266) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/DefaultAbstractGeneratorPlugin.java 2007-03-09 15:34:43 UTC (rev 267) @@ -2,8 +2,7 @@ import salto.tool.jdo.data.JdoInfo; -public abstract class DefaultAbstractGeneratorPlugin implements - IGeneratorPlugin { +public abstract class DefaultAbstractGeneratorPlugin implements IGeneratorPlugin { protected String generator; @@ -23,8 +22,7 @@ this.defaultNameOffset = defaultNameOffset; } - public void init(String generator, String doPrefix, int defaultNameOffset, - String srcPath, String pckName) throws Exception { + public void init(String generator, String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { this.generator = generator; this.doPrefix = doPrefix; this.srcPath = srcPath; @@ -48,4 +46,8 @@ } + public String getDefaultPrefix() { + return ""; + } + } Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOAndTestCasesPlugin.java 2007-03-09 15:34:43 UTC (rev 267) @@ -0,0 +1,73 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +public class SpringEJB3AndHibernateDAOAndTestCasesPlugin extends + SpringEJB3AndHibernateDAOPlugin { + + public void execute(String className, JdoInfo info) throws Exception { + + super.execute(className, info); + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset( + this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + + this.getShortDescription()); + context.put("date", new Date()); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_PATH, "test.vm", srcPath + "/" + + (pckName + ".test").replace('.', '/') + "/", className + + "DAOTest.java", context); + + } + + public String getLongDescription() { + return "This plugin will generate Hibernate EJB3 POJOS, hibernate.cfg.xml, Spring DAOs for each class and unit tests for each dao."; + } + + public String getName() { + return "SpringEJB3AndHibernateDaoAndTestCases"; + } + + public String getShortDescription() { + return "EJB3 + Spring/Hibernate DAO + TestCases"; + } + + public void postExecute(JdoInfo[] infos) throws Exception { + + super.postExecute(infos); + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset( + this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + + this.getShortDescription()); + context.put("date", new Date()); + context.put("dialect", this.ejb3Plugin); + context.put("pckName", pckName); + context.put("annotations", String.valueOf(ejb3Plugin + .isGenerateAnnotations())); + runVelocity(TEMPLATE_PATH, "applicationContext-test.xml.vm", srcPath, + "applicationContext-test.xml", context); + } + +} Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringEJB3AndHibernateDAOPlugin.java 2007-03-09 15:34:43 UTC (rev 267) @@ -0,0 +1,110 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +public class SpringEJB3AndHibernateDAOPlugin extends VelocityAbstractPlugin { + + protected EJB3Plugin ejb3Plugin = null; + + public static final String TEMPLATE_PATH = "springhibernatedao"; + + public void execute(String className, JdoInfo info) throws Exception { + + ejb3Plugin.execute(className, info); + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset( + this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + + this.getShortDescription()); + context.put("date", new Date()); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_PATH, "springhibernatedao.vm", srcPath + "/" + + (pckName + ".hibernate").replace('.', '/') + "/", className + + "HibernateDAO.java", context); + + runVelocity(EJB3AndHibernateDAOPlugin.TEMPLATE_PATH, "dao.vm", srcPath + + "/" + pckName.replace('.', '/') + "/", + className + "DAO.java", context); + + } + + public String getDefaultPrefix() { + return ""; + } + + public String getLongDescription() { + return "This plugin will generate Hibernate EJB3 POJOS, hibernate.cfg.xml and Spring DAOs for each class."; + } + + public String getName() { + return "SpringEJB3AndHibernateDao"; + } + + public String getShortDescription() { + return "EJB3 + Spring/Hibernate DAO"; + } + + public void postExecute(JdoInfo[] infos) throws Exception { + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset( + this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + + this.getShortDescription()); + context.put("date", new Date()); + context.put("dialect", this.ejb3Plugin); + context.put("pckName", pckName); + context.put("annotations", String.valueOf(ejb3Plugin + .isGenerateAnnotations())); + + runVelocity(TEMPLATE_PATH, "springabstracthibernatedao.vm", srcPath + + "/" + (pckName + ".hibernate").replace('.', '/') + "/", + "AbstractHibernateDAO.java", context); + + runVelocity(TEMPLATE_PATH, "genericdao.vm", srcPath + "/" + + pckName.replace('.', '/') + "/", "GenericDAO.java", context); + + runVelocity(TEMPLATE_PATH, "applicationContext-resources.xml.vm", + srcPath, "applicationContext-resources.xml", context); + runVelocity(TEMPLATE_PATH, "applicationContext-hibernate.xml.vm", + srcPath, "applicationContext-hibernate.xml", context); + + } + + public void init(String generator, String doPrefix, int defaultNameOffset, + String srcPath, String pckName) throws Exception { + super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + ejb3Plugin = new EJB3Plugin(); + ejb3Plugin.init(generator, doPrefix, defaultNameOffset, srcPath, + pckName + ".pojo"); + } + + public EJB3Plugin getEjb3Plugin() { + return ejb3Plugin; + } + + public void setEjb3Plugin(EJB3Plugin ejb3Plugin) { + this.ejb3Plugin = ejb3Plugin; + } + +} Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringWebappPlugin.java 2007-03-09 15:34:43 UTC (rev 267) @@ -0,0 +1,78 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +/** + * @author rfl...@sa... + * + */ +public class SpringWebappPlugin extends VelocityAbstractPlugin { + + private SpringEJB3AndHibernateDAOAndTestCasesPlugin plugin; + + public static final String TEMPLATE_PATH = "springwebapp"; + + public void execute(String className, JdoInfo info) throws Exception { + plugin.execute(className, info); + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + this.getShortDescription()); + context.put("date", new Date()); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_PATH, "listcontroller.vm", srcPath + "/" + (pckName + ".webapp.controller").replace('.', '/') + "/", className + "ListController.java", context); + + runVelocity(TEMPLATE_PATH, "list.jsp.vm", srcPath + "/../webapp/WEB-INF/pages", CreatorUtil.getDoNameCreator().class2attribute(className) + "List.jsp", context); + + } + + public void postExecute(JdoInfo[] infos) throws Exception { + //plugin.srcPath += "/../webapp/WEB-INF/"; + plugin.postExecute(infos); + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", generator + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("dialect", this.plugin); + context.put("pckName", pckName); + + runVelocity(TEMPLATE_PATH, "action-servlet.xml.vm", srcPath + "/../webapp/WEB-INF/", "action-servlet.xml", context); + runVelocity(TEMPLATE_PATH, "web.xml.vm", srcPath + "/../webapp/WEB-INF/", "web.xml", context); + } + + public String getLongDescription() { + return "Generate a complete Spring/Hibernate and Spring MVC webapp"; + } + + public String getName() { + return "springWebapp"; + } + + public String getShortDescription() { + return "Generate a complete Spring/Hibernate and Spring MVC webapp"; + } + + public void init(String generator, String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { + super.init(generator, doPrefix, defaultNameOffset, srcPath, pckName); + plugin = new SpringEJB3AndHibernateDAOAndTestCasesPlugin(); + plugin.init(generator, doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); + } + +} Modified: salto-db-generator/trunk/src/plugins.xml =================================================================== --- salto-db-generator/trunk/src/plugins.xml 2007-03-09 15:32:52 UTC (rev 266) +++ salto-db-generator/trunk/src/plugins.xml 2007-03-09 15:34:43 UTC (rev 267) @@ -7,4 +7,7 @@ <plugin class="com.salto.db.generator.plugin.EJB3AndHibernateDAOPlugin" /> <plugin class="com.salto.db.generator.plugin.EJB3HibernateDAOAndTestCasesPlugin" /> <plugin class="com.salto.db.generator.plugin.PojoHibernateDAOPlugin" /> + <plugin class="com.salto.db.generator.plugin.SpringEJB3AndHibernateDAOPlugin" /> + <plugin class="com.salto.db.generator.plugin.SpringEJB3AndHibernateDAOAndTestCasesPlugin" /> + <plugin class="com.salto.db.generator.plugin.SpringWebappPlugin" /> </plugins> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-09 15:32:59
|
Revision: 266 http://svn.sourceforge.net/salto-db/?rev=266&view=rev Author: rflament Date: 2007-03-09 07:32:52 -0800 (Fri, 09 Mar 2007) Log Message: ----------- spring plugins Added Paths: ----------- salto-db-generator/trunk/templates/springwebapp/ salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm salto-db-generator/trunk/templates/springwebapp/list.jsp.vm salto-db-generator/trunk/templates/springwebapp/listcontroller.vm salto-db-generator/trunk/templates/springwebapp/web.xml.vm Added: salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/action-servlet.xml.vm 2007-03-09 15:32:52 UTC (rev 266) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jee="http://www.springframework.org/schema/jee" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"> + + <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> + <property name="exceptionMappings"> + <props> + <prop key="org.springframework.dao.DataAccessException">dataAccessFailure</prop> + </props> + </property> + </bean> + + + <!-- List controllers --> +#foreach($jdoInfo in ${jdoInfos}) + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}ListController" class="${pckName}.webapp.controller.${jdoInfo.javaClassName}ListController"> + <property name="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" ref="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" /> + <property name="viewName" value="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}List" /> + </bean> + +#end + + + <!-- Spring MVC configuration --> + <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> + <property name="basename" value="ApplicationResources" /> + </bean> + + <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> + <property name="mappings"> + <props> +#foreach($jdoInfo in ${jdoInfos}) + <prop key="/list${jdoInfo.javaClassName}.html">${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}ListController</prop> +#end + </props> + </property> + </bean> + + <!-- View Resolver for JSPs --> + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> + <property name="requestContextAttribute" value="rc" /> + <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> + <property name="prefix" value="/WEB-INF/pages/" /> + <property name="suffix" value=".jsp" /> + </bean> + +</beans> \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/list.jsp.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/list.jsp.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/list.jsp.vm 2007-03-09 15:32:52 UTC (rev 266) @@ -0,0 +1,30 @@ +<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + <head> + <title><fmt:message key="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}List.title"/></title> + </head> + <body> + <h1>List of ${jdoInfo.javaClassName}s</h1> + <table> + <tr> +#foreach($col in ${jdoInfo.jdoColInfos}) + <th>${col.javaAttName}</th> +#end + </tr> +<c:forEach items="${${jdoInfo.javaClassName}list}" var="entry"> + <tr> +#foreach($col in ${jdoInfo.jdoColInfos}) + <td><c:out value="\$\{entry.${col.javaAttName}}" /></td> +#end + </tr> +</c:forEach> + </table> + </body> +</html> \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/listcontroller.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/listcontroller.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/listcontroller.vm 2007-03-09 15:32:52 UTC (rev 266) @@ -0,0 +1,39 @@ +package ${jdoInfo.javaPckName}.webapp.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.ParameterizableViewController; + +import com.salto.pojodao.pojo.${jdoInfo.javaClassName}DAO; + +/** + * <p>Spring controller to diplay list of ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}ListController extends ParameterizableViewController { + + private ${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + + public void set${jdoInfo.javaClassName}DAO(${jdoInfo.javaClassName}DAO ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO) { + this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO = ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + public ${jdoInfo.javaClassName}DAO get${jdoInfo.javaClassName}DAO() { + return this.${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO; + } + + @SuppressWarnings("unchecked") + @Override + protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { + ModelAndView modelAndView = super.handleRequestInternal(request, response); + + modelAndView.addObject("${jdoInfo.javaClassName}list", ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.findAll()); + + return modelAndView; + } + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springwebapp/web.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springwebapp/web.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springwebapp/web.xml.vm 2007-03-09 15:32:52 UTC (rev 266) @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> +<!-- This file has been generated by ${generatorVersion} at $date --> +<web-app> + <display-name>Salto-db Generator Spring webapp</display-name> + + <context-param> + <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> + <param-value>ApplicationResources</param-value> + </context-param> + <context-param> + <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name> + <param-value>en</param-value> + </context-param> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>/WEB-INF/applicationContext-*.xml,/WEB-INF/security.xml</param-value> + </context-param> + + <filter> + <filter-name>encodingFilter</filter-name> + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>forceEncoding</param-name> + <param-value>true</param-value> + </init-param> + </filter> + <filter> + <filter-name>hibernateFilter</filter-name> + <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>encodingFilter</filter-name> + <url-pattern>*.html</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>encodingFilter</filter-name> + <url-pattern>*.jsp</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>hibernateFilter</filter-name> + <url-pattern>*.html</url-pattern> + </filter-mapping> + + <listener> + <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> + </listener> + + <servlet> + <servlet-name>action</servlet-name> + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> + <load-on-startup>2</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>action</servlet-name> + <url-pattern>*.html</url-pattern> + </servlet-mapping> + + <session-config> + <session-timeout>180</session-timeout> + </session-config> + + <welcome-file-list> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + +</web-app> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-09 15:32:34
|
Revision: 265 http://svn.sourceforge.net/salto-db/?rev=265&view=rev Author: rflament Date: 2007-03-09 07:32:11 -0800 (Fri, 09 Mar 2007) Log Message: ----------- spring plugins Added Paths: ----------- salto-db-generator/trunk/templates/springhibernatedao/ salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm salto-db-generator/trunk/templates/springhibernatedao/applicationContext-resources.xml.vm salto-db-generator/trunk/templates/springhibernatedao/applicationContext-test.xml.vm salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm salto-db-generator/trunk/templates/springhibernatedao/springhibernatedao.vm salto-db-generator/trunk/templates/springhibernatedao/test.vm Added: salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/applicationContext-hibernate.xml.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> + + <!-- Hibernate SessionFactory --> + <bean id="sessionFactory" + class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <property name="dataSource" ref="dataSource" /> + <property name="annotatedClasses"> + <list> +#foreach($jdoInfo in ${jdoInfos}) + <value>${pckName}.pojo.${jdoInfo.javaClassName}</value> +#if ($util.getLength($jdoInfo.getPk()) > 1) + <value>${pckName}.pojo.${jdoInfo.javaClassName}\$${jdoInfo.javaClassName}PK</value> +#end +#end + </list> + </property> + <property name="hibernateProperties"> + <props> +#if ($dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})) + <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}--> + <prop key="hibernate.dialect">$dialect.getDialect(${connInfo.conn.getMetaData().getDatabaseProductName()})</prop> +#else + <!-- Your database is ${connInfo.conn.getMetaData().getDatabaseProductName()}. No dialect is known by Salto-db-generator for this database. + If you know what dialect to use, please send an email to rfl...@sa... and precise that the database is + "${connInfo.conn.getMetaData().getDatabaseProductName()}". Thank you. --> + <prop key="hibernate.dialect"> SET THE DATABASE DIALECT HERE </prop> +#end + <prop key="hibernate.query.substitutions">Y</prop> + <prop key="hibernate.show_sql">true</prop> + <!-- Turn batching off for better error messages under PostgreSQL + <prop key="hibernate.jdbc.batch_size">0</prop> --> + </props> + </property> + </bean> + + + <bean id="myHibernateInterceptor" + class="org.springframework.orm.hibernate3.HibernateInterceptor"> + <property name="sessionFactory"> + <ref local="sessionFactory" /> + </property> + </bean> + + <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --> + <bean id="transactionManager" + class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory" ref="sessionFactory" /> + </bean> +#foreach($jdoInfo in ${jdoInfos}) + + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" class="${pckName}.hibernate.${jdoInfo.javaClassName}HibernateDAO"> + <property name="sessionFactory" ref="sessionFactory" /> + </bean> +#end + +</beans> Added: salto-db-generator/trunk/templates/springhibernatedao/applicationContext-resources.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/applicationContext-resources.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/applicationContext-resources.xml.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jee="http://www.springframework.org/schema/jee" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"> + + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="${connInfo.driver}"/> + <property name="url" value="${connInfo.url}"/> + <property name="username" value="${connInfo.user}"/> + <property name="password" value="${connInfo.pwd}"/> + <property name="maxActive" value="100"/> + <property name="maxIdle" value="30"/> + <property name="maxWait" value="1000"/> + <property name="defaultAutoCommit" value="true"/> + <property name="removeAbandoned" value="true"/> + <property name="removeAbandonedTimeout" value="60"/> + </bean> + + + + <!-- JNDI DataSource for J2EE environments, replace XXXX by your pool name if needed --> + <!-- <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/XXXXX"/> --> + + +</beans> Added: salto-db-generator/trunk/templates/springhibernatedao/applicationContext-test.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/applicationContext-test.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/applicationContext-test.xml.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> + + <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> + <property name="driverClassName" value="${connInfo.driver}"/> + <property name="url" value="${connInfo.url}"/> + <property name="username" value="${connInfo.user}"/> + <property name="password" value="${connInfo.pwd}"/> + </bean> + + +#foreach($jdoInfo in ${jdoInfos}) + <bean id="testEntity${jdoInfo.javaClassName}" class="${pckName}.pojo.${jdoInfo.javaClassName}"/> +#end + +#foreach($jdoInfo in ${jdoInfos}) + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAOTest" class="${pckName}.test.${jdoInfo.javaClassName}DAOTest"/> +#end + +</beans> Added: salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/genericdao.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,29 @@ +package $pckName; + +import java.io.Serializable; +import java.util.List; + +/** + * Generated at $date + * + * @author ${generatorVersion} + */ +public interface GenericDAO<T, ID extends Serializable> { + + T getById(ID id); + + List<T> findAll(); + + void save(T entity); + + void update(T entity); + + void saveOrUpdate(T entity); + + void delete(T entity); + + void delete(T entity, Boolean doItNow); + + int deleteById(ID id); + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/springabstracthibernatedao.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,79 @@ +package ${pckName}.hibernate; + +import ${pckName}.GenericDAO; +import java.io.Serializable; + +import org.hibernate.FlushMode; +import org.hibernate.Query; + +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +/** + * Generated at $date + * + * @author ${generatorVersion} + */ +public abstract class AbstractHibernateDAO<T, ID extends Serializable> extends HibernateDaoSupport implements GenericDAO<T, ID> { + + public void save(T entity) { + getSession().save(entity); + } + + public void update(T entity) { + getSession().update(entity); + } + + public void saveOrUpdate(T entity) { + getSession().saveOrUpdate(entity); + } + + public void delete(T entity) { + getSession().delete(entity); + } + + public void delete(T entity, Boolean doItNow) { + if (doItNow) { + getSession().setFlushMode(FlushMode.ALWAYS); + } + delete(entity); + } + + /** + * This method will execute an HQL query and return the number of affected entities. + */ + protected int executeQuery(String query, String namedParams[], Object params[]) { + Query q = getSession().createQuery(query); + + if (namedParams != null) { + for (int i = 0; i < namedParams.length; i++) { + q.setParameter(namedParams[i], params[i]); + } + } + + return q.executeUpdate(); + } + + protected int executeQuery(String query) { + return executeQuery(query, null, null); + } + + /** + * This method will execute a Named HQL query and return the number of affected entities. + */ + protected int executeNamedQuery(String namedQuery, String namedParams[], Object params[]) { + Query q = getSession().getNamedQuery(namedQuery); + + if (namedParams != null) { + for (int i = 0; i < namedParams.length; i++) { + q.setParameter(namedParams[i], params[i]); + } + } + + return q.executeUpdate(); + } + + protected int executeNamedQuery(String namedQuery) { + return executeNamedQuery(namedQuery, null, null); + } + +} Added: salto-db-generator/trunk/templates/springhibernatedao/springhibernatedao.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/springhibernatedao.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/springhibernatedao.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,191 @@ +package ${jdoInfo.javaPckName}.hibernate; + +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; +#if ($util.getLength($jdoInfo.getPk()) > 1) +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}.${jdoInfo.javaClassName}PK; +#end + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.criterion.Restrictions; +#set ($pk="Long") +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($pk=$util.getClassNameForPrimitive($col.javaAttClass)) +#end +#end +#end +#if ($util.getLength($jdoInfo.getPk()) > 1) +#set ($pk="${jdoInfo.javaClassName}PK") +#end + +/** + * <p>Hibernate DAO layer for ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}HibernateDAO extends + AbstractHibernateDAO<${jdoInfo.javaClassName}, $pk> implements + ${jdoInfo.javaClassName}DAO { + + public ${jdoInfo.javaClassName} getById($pk id) { + return (${jdoInfo.javaClassName}) getSession().get(${jdoInfo.javaClassName}.class, id); + } + + /** + * Find ${jdoInfo.javaClassName} by criteria. + * If a parameter is null it is not used in the query. + * //FIXME: there's certainly an issue with foreign keys... + */ +#set ($isfirst="true") + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findByCriteria(#foreach($col in ${jdoInfo.jdoColInfos})#set ($ispk="false")#foreach($colpk in ${jdoInfo.getPk()})#if ($colpk.col.equals($col.colName))#set ($ispk="true")#end#end#if ($ispk=="false")#if ($isfirst=="false"), #end$col.getNonPrimitifClass() ${col.javaAttName}#set ($isfirst="false")#end#end) { + + Criteria criteria = getSession().createCriteria(${jdoInfo.javaClassName}.class); + +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#if ($ispk=="false") + if (${col.javaAttName} != null) { + criteria.add(Restrictions.eq("${col.javaAttName}", ${col.javaAttName})); + } + +#end +#end + return criteria.list(); + } + + /** + * Find ${jdoInfo.javaClassName} by criteria. + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findByCriteria(Map criterias) { + + Criteria criteria = getSession().createCriteria(${jdoInfo.javaClassName}.class); + criteria.add(Restrictions.allEq(criterias)); + return criteria.list(); + } + + public int deleteById($pk id) { + Query q = getSession().createQuery("delete from ${jdoInfo.javaClassName} where id = :id"); + q.setParameter("id",id); + return q.executeUpdate(); + } + + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findAll() { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName}"); + q.setCacheable(true); + return q.list(); + } + +#if ($util.getLength($jdoInfo.getPk()) > 1) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + /** + * Find ${jdoInfo.javaClassName} by ${col.javaAttName} + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findBy$util.doNameCreator.attribute2class($col.javaAttName)($col.getNonPrimitifClass() ${col.javaAttName}) { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName} where $util.doNameCreator.class2attribute($util.doNameCreator.createDoName(${colfk2.getPkTableName()})).${col.javaAttName} = :${col.javaAttName}"); + q.setParameter("${col.javaAttName}",${col.javaAttName}); + q.setCacheable(true); + return q.list(); + } + +#end +#end +#end +#if ($isfk=="false" && $ispk=="false") + /** + * Find ${jdoInfo.javaClassName} by ${col.javaAttName} + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findBy$util.doNameCreator.attribute2class($col.javaAttName)($col.getNonPrimitifClass() ${col.javaAttName}) { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName} where ${col.javaAttName} = :${col.javaAttName}"); + q.setParameter("${col.javaAttName}",${col.javaAttName}); + q.setCacheable(true); + return q.list(); + } + +#else +#if ($ispk=="true" && $isfk=="false") + /** + * Find ${jdoInfo.javaClassName} by ${col.javaAttName} + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findBy$util.doNameCreator.attribute2class($col.javaAttName)($col.getNonPrimitifClass() ${col.javaAttName}) { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName} where id.${col.javaAttName} = :${col.javaAttName}"); + q.setParameter("${col.javaAttName}",${col.javaAttName}); + q.setCacheable(true); + return q.list(); + } +#end +#end +#end +#else +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + /** + * Find ${jdoInfo.javaClassName} by ${col.javaAttName} + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findBy$util.doNameCreator.attribute2class($col.javaAttName)($col.getNonPrimitifClass() ${col.javaAttName}) { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName} where $util.doNameCreator.class2attribute($util.doNameCreator.createDoName(${colfk2.getPkTableName()})).${col.javaAttName} = :${col.javaAttName}"); + q.setParameter("${col.javaAttName}",${col.javaAttName}); + q.setCacheable(true); + return q.list(); + } + +#end +#end +#end +#if ($ispk=="false" && $isfk=="false") + /** + * Find ${jdoInfo.javaClassName} by ${col.javaAttName} + */ + @SuppressWarnings("unchecked") + public List<${jdoInfo.javaClassName}> findBy$util.doNameCreator.attribute2class($col.javaAttName)($col.getNonPrimitifClass() ${col.javaAttName}) { + Query q = getSession().createQuery("from ${jdoInfo.javaClassName} where ${col.javaAttName} = :${col.javaAttName}"); + q.setParameter("${col.javaAttName}",${col.javaAttName}); + q.setCacheable(true); + return q.list(); + } + +#end +#end +#end + +} Added: salto-db-generator/trunk/templates/springhibernatedao/test.vm =================================================================== --- salto-db-generator/trunk/templates/springhibernatedao/test.vm (rev 0) +++ salto-db-generator/trunk/templates/springhibernatedao/test.vm 2007-03-09 15:32:11 UTC (rev 265) @@ -0,0 +1,268 @@ +package ${jdoInfo.javaPckName}.test; + +import java.util.List; +import java.sql.Timestamp; + +import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; + +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; +import ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO; +#set ($pk="Long") +#set ($pkname="") +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($pk=$util.getClassNameForPrimitive($col.javaAttClass)) +#set ($pkname=$util.getDoNameCreator().attribute2class($col.javaAttName)) +#end +#end +#end +#if ($util.getLength($jdoInfo.getPk()) > 1) +#set ($pk="${jdoInfo.javaClassName}PK") +#set ($pkname="${jdoInfo.javaClassName}PK") +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}.${jdoInfo.javaClassName}PK; +#end + +/** + * <p>Spring Unit test for ${jdoInfo.javaPckName}.${jdoInfo.javaClassName}DAO</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}DAOTest extends AbstractTransactionalDataSourceSpringContextTests { + + protected String[] getConfigLocations() { + setAutowireMode(AUTOWIRE_BY_NAME); + setDependencyCheck(false); + return new String[] { "classpath*:/**/applicationContext-hibernate.xml", + "classpath*:/**/applicationContext-test.xml" + + }; + } + + + + private ${jdoInfo.javaClassName}DAO dao; + +#if ($pkname!="") + private $pk existingId; +#end + + private ${jdoInfo.javaClassName} testEntity${jdoInfo.javaClassName}; + +#if ($util.getLength($jdoInfo.getPk()) > 1) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + private ${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName); + +#end +#end +#end +#if ($isfk=="false" && $ispk=="false") + private ${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName); + +#else +#if ($ispk=="true" && $isfk=="false") + private ${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName); +#end +#end +#end +#else +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + private ${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName); + +#end +#end +#end +#if ($ispk=="false" && $isfk=="false") + private ${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName); + +#end +#end +#end + + public void set${jdoInfo.javaClassName}DAO(${jdoInfo.javaClassName}DAO dao) { + this.dao = dao; + } + + public ${jdoInfo.javaClassName}DAO get${jdoInfo.javaClassName}DAO() { + return this.dao; + } + +#if ($pkname!="") + public void setExistingId(${pk} id) { + this.existingId = id; + } + + public ${pk} getExistingId() { + return this.existingId; + } +#end + + public ${jdoInfo.javaClassName} getTestEntity${jdoInfo.javaClassName}() { + return testEntity${jdoInfo.javaClassName}; + } + + public void setTestEntity${jdoInfo.javaClassName}(${jdoInfo.javaClassName} testEntity${jdoInfo.javaClassName}) { + this.testEntity${jdoInfo.javaClassName} = testEntity${jdoInfo.javaClassName}; + } + + public void testGetById() { +#if ($pkname!="") + ${jdoInfo.javaClassName} test = dao.getById(existingId); + assertNotNull(test); +#end + } + + public void testFindAll() { + List<${jdoInfo.javaClassName}> all = dao.findAll(); + assertNotNull("testFindAll", all); + assertFalse("testFindAll", all.isEmpty()); + } + + public void testSaveAndRemove() { +#if ($pkname!="") + dao.save(testEntity${jdoInfo.javaClassName}); + ${jdoInfo.javaClassName} test = dao.getById(testEntity${jdoInfo.javaClassName}.get${pkname}()); + assertNotNull("testSaveAndRemove", testEntity${jdoInfo.javaClassName}.get${pkname}()); + assertNotNull("testSaveAndRemove", test); + dao.delete(testEntity${jdoInfo.javaClassName}); + test = dao.getById(testEntity${jdoInfo.javaClassName}.get${pkname}()); + assertNull("testSaveAndRemove", test); +#end + } + +#if ($util.getLength($jdoInfo.getPk()) > 1) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + public ${col.javaAttClass} getTest$util.getDoNameCreator().attribute2class($col.javaAttName)() { + return test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void setTest$util.getDoNameCreator().attribute2class($col.javaAttName)(${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName)) { + this.test$util.getDoNameCreator().attribute2class($col.javaAttName) = test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void testFindBy$util.doNameCreator.attribute2class($col.javaAttName)() { + List<${jdoInfo.javaClassName}> list = dao.findBy$util.doNameCreator.attribute2class($col.javaAttName)(test$util.getDoNameCreator().attribute2class($col.javaAttName)); + assertNotNull("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list); + assertFalse("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list.isEmpty()); + } + +#end +#end +#end +#if ($isfk=="false" && $ispk=="false") + public ${col.javaAttClass} getTest$util.getDoNameCreator().attribute2class($col.javaAttName)() { + return test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void setTest$util.getDoNameCreator().attribute2class($col.javaAttName)(${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName)) { + this.test$util.getDoNameCreator().attribute2class($col.javaAttName) = test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void testFindBy$util.doNameCreator.attribute2class($col.javaAttName)() { + List<${jdoInfo.javaClassName}> list = dao.findBy$util.doNameCreator.attribute2class($col.javaAttName)(test$util.getDoNameCreator().attribute2class($col.javaAttName)); + assertNotNull("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list); + assertFalse("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list.isEmpty()); + } + +#else +#if ($ispk=="true" && $isfk=="false") + public ${col.javaAttClass} getTest$util.getDoNameCreator().attribute2class($col.javaAttName)() { + return test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void setTest$util.getDoNameCreator().attribute2class($col.javaAttName)(${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName)) { + this.test$util.getDoNameCreator().attribute2class($col.javaAttName) = test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void testFindBy$util.doNameCreator.attribute2class($col.javaAttName)() { + List<${jdoInfo.javaClassName}> list = dao.findBy$util.doNameCreator.attribute2class($col.javaAttName)(test$util.getDoNameCreator().attribute2class($col.javaAttName)); + assertNotNull("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list); + assertFalse("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list.isEmpty()); + } +#end +#end +#end +#else +#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($ispk="false") +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set ($ispk="true") +#end +#end +#set ($isfk="false") +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set ($isfk="true") + public ${col.javaAttClass} getTest$util.getDoNameCreator().attribute2class($col.javaAttName)() { + return test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void setTest$util.getDoNameCreator().attribute2class($col.javaAttName)(${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName)) { + this.test$util.getDoNameCreator().attribute2class($col.javaAttName) = test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void testFindBy$util.doNameCreator.attribute2class($col.javaAttName)() { + List<${jdoInfo.javaClassName}> list = dao.findBy$util.doNameCreator.attribute2class($col.javaAttName)(test$util.getDoNameCreator().attribute2class($col.javaAttName)); + assertNotNull("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list); + assertFalse("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list.isEmpty()); + } + +#end +#end +#end +#if ($ispk=="false" && $isfk=="false") + public ${col.javaAttClass} getTest$util.getDoNameCreator().attribute2class($col.javaAttName)() { + return test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void setTest$util.getDoNameCreator().attribute2class($col.javaAttName)(${col.javaAttClass} test$util.getDoNameCreator().attribute2class($col.javaAttName)) { + this.test$util.getDoNameCreator().attribute2class($col.javaAttName) = test$util.getDoNameCreator().attribute2class($col.javaAttName); + } + + public void testFindBy$util.doNameCreator.attribute2class($col.javaAttName)() { + List<${jdoInfo.javaClassName}> list = dao.findBy$util.doNameCreator.attribute2class($col.javaAttName)(test$util.getDoNameCreator().attribute2class($col.javaAttName)); + assertNotNull("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list); + assertFalse("testFindBy$util.doNameCreator.attribute2class($col.javaAttName)", list.isEmpty()); + } + +#end +#end +#end + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-03 19:08:19
|
Revision: 264 http://svn.sourceforge.net/salto-db/?rev=264&view=rev Author: rflament Date: 2007-03-03 11:08:14 -0800 (Sat, 03 Mar 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/templates/ejb3/dataobject.vm salto-db-generator/trunk/templates/hibernateejb3dao/abstracthibernatedao.vm salto-db-generator/trunk/templates/hibernateejb3dao/dao.vm salto-db-generator/trunk/templates/hibernateejb3dao/daofactory.vm salto-db-generator/trunk/templates/hibernateejb3dao/genericdao.vm salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedao.vm salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedaofactory.vm salto-db-generator/trunk/templates/hibernateejb3dao/hibernateutil.vm Modified: salto-db-generator/trunk/templates/ejb3/dataobject.vm =================================================================== --- salto-db-generator/trunk/templates/ejb3/dataobject.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/ejb3/dataobject.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -22,9 +22,9 @@ /** #if ($jdoInfo.tableShem) - * <p>Pojo mapping table ${jdoInfo.tableShem}.${jdoInfo.tableName}</p> + * <p>Pojo mapping ${jdoInfo.tableType} ${jdoInfo.tableShem}.${jdoInfo.tableName}</p> #else - * <p>Pojo mapping table ${jdoInfo.tableName}</p> + * <p>Pojo mapping ${jdoInfo.tableType} ${jdoInfo.tableName}</p> #end #if ($jdoInfo.getTableRemarks()) * <p>${jdoInfo.getTableRemarks()}</p> Modified: salto-db-generator/trunk/templates/hibernateejb3dao/abstracthibernatedao.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/abstracthibernatedao.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/abstracthibernatedao.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -2,35 +2,63 @@ import ${pckName}.GenericDAO; import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import org.hibernate.Criteria; import org.hibernate.FlushMode; import org.hibernate.Query; import org.hibernate.LockMode; import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Example; /** * Generated at $date * * @author ${generatorVersion} + * @see http://www.hibernate.org/328.html */ public abstract class AbstractHibernateDAO<T, ID extends Serializable> implements GenericDAO<T, ID> { private Session session; - public AbstractHibernateDAO(Session s) { - session = s; + private Class<T> persistentClass; + + public AbstractHibernateDAO() { + this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } - - public Session getSession() { - return session; - } + protected Session getSession() { + if (session == null) + session = HibernateUtil.getSessionFactory().getCurrentSession(); + return session; + } + + public Class<T> getPersistentClass() { + return persistentClass; + } + public void setSession(Session session) { this.session = session; } + @SuppressWarnings("unchecked") + public T getById(ID id) { + return (T) getSession().get(getPersistentClass(), id); + } + + @SuppressWarnings("unchecked") + public T getById(ID id, boolean lock) { + if (lock) { + return (T) getSession().get(getPersistentClass(), id, + LockMode.UPGRADE); + } else + return getById(id); + } + public void save(T entity) { -getSession().save(entity); + getSession().save(entity); } public void update(T entity) { @@ -42,17 +70,34 @@ } public void delete(T entity) { -getSession().delete(entity); + getSession().delete(entity); } public void delete(T entity, Boolean doItNow) { if (doItNow) { -getSession().setFlushMode(FlushMode.ALWAYS); + getSession().setFlushMode(FlushMode.ALWAYS); } delete(entity); } + @SuppressWarnings("unchecked") + public List<T> findAll() { + return findByCriteria(); + } + /** + * Use this inside subclasses as a convenience method. + */ + @SuppressWarnings("unchecked") + protected List<T> findByCriteria(Criterion... criterion) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } + + /** * This method will execute an HQL query and return the number of affected entities. */ protected int executeQuery(String query, String namedParams[], Object params[]) { @@ -90,4 +135,15 @@ return executeNamedQuery(namedQuery, null, null); } + @SuppressWarnings("unchecked") + public List<T> findByExample(T exampleInstance, String[] excludeProperty) { + Criteria crit = getSession().createCriteria(getPersistentClass()); + Example example = Example.create(exampleInstance); + for (String exclude : excludeProperty) { + example.excludeProperty(exclude); + } + crit.add(example); + return crit.list(); + } + } Modified: salto-db-generator/trunk/templates/hibernateejb3dao/dao.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/dao.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/dao.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -24,6 +24,7 @@ * <p>Generated at $date</p> * * @author ${generatorVersion} + * @see http://www.hibernate.org/328.html */ public interface ${jdoInfo.javaClassName}DAO extends GenericDAO<${jdoInfo.javaClassName},$pk> { Modified: salto-db-generator/trunk/templates/hibernateejb3dao/daofactory.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/daofactory.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/daofactory.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -15,6 +15,17 @@ public static final DAOFactory DEFAULT = HIBERNATE; + /** + * Factory method for instantiation of concrete factories. + */ + public static DAOFactory instance(Class factory) { + try { + return (DAOFactory)factory.newInstance(); + } catch (Exception ex) { + throw new RuntimeException("Couldn't create DAOFactory: " + factory); + } + } + #foreach($jdoInfo in ${jdoInfos}) public abstract ${jdoInfo.javaClassName}DAO build${jdoInfo.javaClassName}DAO(); Modified: salto-db-generator/trunk/templates/hibernateejb3dao/genericdao.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/genericdao.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/genericdao.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -7,6 +7,7 @@ * Generated at $date * * @author ${generatorVersion} + * @see http://www.hibernate.org/328.html */ public interface GenericDAO<T, ID extends Serializable> { Modified: salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/hibernate.cfg.xml.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -21,6 +21,9 @@ #end <property name="connection.password">${connInfo.pwd}</property> <property name="show_sql">true</property> + + <!-- Remove this property if you use JTA --> + <property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property> #foreach($jdoInfo in ${jdoInfos}) <mapping class="${pckName}.pojo.${jdoInfo.javaClassName}" /> Modified: salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedao.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedao.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedao.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -11,7 +11,6 @@ #end import org.hibernate.Criteria; -import org.hibernate.LockMode; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; @@ -32,26 +31,11 @@ * <p>Generated at $date</p> * * @author ${generatorVersion} + * @see http://www.hibernate.org/328.html */ public class ${jdoInfo.javaClassName}HibernateDAO extends AbstractHibernateDAO<${jdoInfo.javaClassName}, $pk> implements ${jdoInfo.javaClassName}DAO { - - public ${jdoInfo.javaClassName}HibernateDAO(Session s) { - super(s); - } - - public ${jdoInfo.javaClassName} getById($pk id) { - return (${jdoInfo.javaClassName}) getSession().get(${jdoInfo.javaClassName}.class, id); - } - - public ${jdoInfo.javaClassName} getById($pk id, boolean lock) { - if (lock) { - return (${jdoInfo.javaClassName}) getSession().get(${jdoInfo.javaClassName}.class, id, - LockMode.UPGRADE); - } else - return getById(id); - } /** * Find ${jdoInfo.javaClassName} by criteria. @@ -98,13 +82,6 @@ return q.executeUpdate(); } - @SuppressWarnings("unchecked") - public List<${jdoInfo.javaClassName}> findAll() { - Query q = getSession().createQuery("from ${jdoInfo.javaClassName}"); - q.setCacheable(true); - return q.list(); - } - #if ($util.getLength($jdoInfo.getPk()) > 1) #foreach($col in ${jdoInfo.jdoColInfos}) #set ($ispk="false") Modified: salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedaofactory.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedaofactory.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/hibernatedaofactory.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -19,7 +19,7 @@ */ @Override public ${jdoInfo.javaClassName}DAO build${jdoInfo.javaClassName}DAO() { - return new ${jdoInfo.javaClassName}HibernateDAO(HibernateUtil.getSession()); + return new ${jdoInfo.javaClassName}HibernateDAO(); } #end Modified: salto-db-generator/trunk/templates/hibernateejb3dao/hibernateutil.vm =================================================================== --- salto-db-generator/trunk/templates/hibernateejb3dao/hibernateutil.vm 2007-03-03 17:47:22 UTC (rev 263) +++ salto-db-generator/trunk/templates/hibernateejb3dao/hibernateutil.vm 2007-03-03 19:08:14 UTC (rev 264) @@ -18,10 +18,6 @@ private static SessionFactory sessionFactory; - private static final ThreadLocal threadSession = new ThreadLocal(); - - private static final ThreadLocal threadTransaction = new ThreadLocal(); - static { try { #if ($annotations=="true") @@ -48,88 +44,4 @@ return sessionFactory; } - /** - * Retrieves the current Session local to the thread. <p/> If no Session is - * open, opens a new Session for the running thread. - * - * @return Session - */ - @SuppressWarnings("unchecked") - public static Session getSession() { - Session s = (Session) threadSession.get(); - - if (s == null) { - - s = getSessionFactory().openSession(); - - threadSession.set(s); - beginTransaction(); - } - - return s; - } - - /** - * Closes the Session local to the thread. - */ - @SuppressWarnings("unchecked") - public static void closeSession() { - - Session s = (Session) threadSession.get(); - threadSession.set(null); - if (s != null && s.isOpen()) { - - s.close(); - } - - } - - /** - * Start a new database transaction. - */ - @SuppressWarnings("unchecked") - public static void beginTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx == null) { - - tx = getSession().beginTransaction(); - threadTransaction.set(tx); - } - - } - - /** - * Commit the database transaction. - */ - @SuppressWarnings("unchecked") - public static void commitTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.commit(); - } - threadTransaction.set(null); - - } - - /** - * Rollback the database transaction. - */ - @SuppressWarnings("unchecked") - public static void rollbackTransaction() { - Transaction tx = (Transaction) threadTransaction.get(); - try { - threadTransaction.set(null); - if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { - - tx.rollback(); - } - - } finally { - closeSession(); - } - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-03 17:47:23
|
Revision: 263 http://svn.sourceforge.net/salto-db/?rev=263&view=rev Author: rflament Date: 2007-03-03 09:47:22 -0800 (Sat, 03 Mar 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/site/apt/roadmap.apt Modified: salto-db-generator/trunk/src/site/apt/roadmap.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/roadmap.apt 2007-03-03 17:45:55 UTC (rev 262) +++ salto-db-generator/trunk/src/site/apt/roadmap.apt 2007-03-03 17:47:22 UTC (rev 263) @@ -4,7 +4,7 @@ Roadmap - The next version will be version 1.1. Here are plans for v1.1 : + Here are plans for v1.1 : * Core Api rewrite so plugins will be easier to write This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-03-03 17:45:57
|
Revision: 262 http://svn.sourceforge.net/salto-db/?rev=262&view=rev Author: rflament Date: 2007-03-03 09:45:55 -0800 (Sat, 03 Mar 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedaotests.apt salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt Modified: salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt 2007-02-26 08:29:29 UTC (rev 261) +++ salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedao.apt 2007-03-03 17:45:55 UTC (rev 262) @@ -2,7 +2,7 @@ EJB3 And Hibernate DAOs plugin --- -EJB3 And Hibernate DAOs plugin +EJB3 And Hibernate DAOs plugin (beta) This plugin generates EJB3 entities (like the EJB3 plugin), a abstract persistence layer and an hibernate annotation implementation of this layer. @@ -1060,5 +1060,5 @@ DAOFactory.DEFAULT.buildPersonDAO().save(person); +--------------------------------------------------------------+ - As you can see, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can + As you can see, thanks to Hibernate and to the generic dao pattern, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can focus on business logic instead of loosing time managing connections, transactions and so on. \ No newline at end of file Modified: salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedaotests.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedaotests.apt 2007-02-26 08:29:29 UTC (rev 261) +++ salto-db-generator/trunk/src/site/apt/plugins/ejb3hibernatedaotests.apt 2007-03-03 17:45:55 UTC (rev 262) @@ -2,7 +2,7 @@ EJB3, Hibernate DAOs and Junit tests plugin --- -EJB3, Hibernate DAOs and JUnit tests plugin +EJB3, Hibernate DAOs and JUnit tests plugin (beta) This plugin generates the same files as the {{{ejb3hibernatedao.html}"EJB3 And Hibernate Daos" plugin}}, plus JUnit testcases for every generated daos. Modified: salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt 2007-02-26 08:29:29 UTC (rev 261) +++ salto-db-generator/trunk/src/site/apt/plugins/pojohibernatedao.apt 2007-03-03 17:45:55 UTC (rev 262) @@ -2,7 +2,7 @@ Pojos and Hibernate DAOs plugin --- -Pojos and Hibernate DAOs plugin +Pojos and Hibernate DAOs plugin (beta) This plugin generates pojos (like the Hibernate plugin), a abstract persistence layer and an hibernate implementation of this layer. @@ -1068,5 +1068,5 @@ DAOFactory.DEFAULT.buildPersonDAO().save(person); +--------------------------------------------------------------+ - As you can see, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can + As you can see, thanks to Hibernate and to the generic dao pattern, there is absolutely no reference to hibernate or even to database management in the code you have to write. You can focus on business logic instead of loosing time managing connections, transactions and so on. \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-26 08:29:32
|
Revision: 261 http://svn.sourceforge.net/salto-db/?rev=261&view=rev Author: rflament Date: 2007-02-26 00:29:29 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added Paths: ----------- salto-db-generator/tags/v1_0_15/ Copied: salto-db-generator/tags/v1_0_15 (from rev 260, salto-db-generator/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 11:08:28
|
Revision: 260 http://svn.sourceforge.net/salto-db/?rev=260&view=rev Author: rflament Date: 2007-02-24 03:08:01 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/site/apt/roadmap.apt Modified: salto-db-generator/trunk/src/site/apt/roadmap.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/roadmap.apt 2007-02-24 10:53:38 UTC (rev 259) +++ salto-db-generator/trunk/src/site/apt/roadmap.apt 2007-02-24 11:08:01 UTC (rev 260) @@ -4,7 +4,7 @@ Roadmap - The next version will be version 1.2. Here are plans for v1.2 : + The next version will be version 1.1. Here are plans for v1.1 : * Core Api rewrite so plugins will be easier to write This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 10:53:39
|
Revision: 259 http://svn.sourceforge.net/salto-db/?rev=259&view=rev Author: rflament Date: 2007-02-24 02:53:38 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/pom.xml Modified: salto-db-generator/trunk/pom.xml =================================================================== --- salto-db-generator/trunk/pom.xml 2007-02-24 10:42:53 UTC (rev 258) +++ salto-db-generator/trunk/pom.xml 2007-02-24 10:53:38 UTC (rev 259) @@ -194,6 +194,15 @@ </plugins> - </reporting> + </reporting> + + <distributionManagement> + <site> + <id>Sourcefore website</id> + <url>scp://shell.sf.net/home/groups/s/sa/salto-db/htdocs/salto-db-generator</url> + </site> + </distributionManagement> + + </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 10:42:54
|
Revision: 258 http://svn.sourceforge.net/salto-db/?rev=258&view=rev Author: rflament Date: 2007-02-24 02:42:53 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/pom.xml Modified: salto-db-generator/trunk/pom.xml =================================================================== --- salto-db-generator/trunk/pom.xml 2007-02-24 10:40:36 UTC (rev 257) +++ salto-db-generator/trunk/pom.xml 2007-02-24 10:42:53 UTC (rev 258) @@ -13,7 +13,7 @@ <packaging>jar</packaging> - <version>1.0.15-SNAPSHOT</version> + <version>1.0.15</version> <inceptionYear>2002</inceptionYear> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 10:40:37
|
Revision: 257 http://svn.sourceforge.net/salto-db/?rev=257&view=rev Author: rflament Date: 2007-02-24 02:40:36 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/pom.xml Modified: salto-db-generator/trunk/pom.xml =================================================================== --- salto-db-generator/trunk/pom.xml 2007-02-24 10:21:56 UTC (rev 256) +++ salto-db-generator/trunk/pom.xml 2007-02-24 10:40:36 UTC (rev 257) @@ -33,7 +33,7 @@ </mailingList> </mailingLists> - <url>http://salto-db.sourceforge.net/</url> + <url>http://salto-db.sourceforge.net/salto-db-generator</url> <licenses> <license> @@ -132,7 +132,7 @@ <developers> <developer> <id>rflament</id> - <name>R\xE9mi Flament</name> + <name>Rémi Flament</name> <email>rfl...@la...</email> <organization>Salto Consulting</organization> <roles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 10:21:57
|
Revision: 256 http://svn.sourceforge.net/salto-db/?rev=256&view=rev Author: rflament Date: 2007-02-24 02:21:56 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Property Changed: ---------------- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar Property changes on: salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2007-02-24 10:21:40
|
Revision: 255 http://svn.sourceforge.net/salto-db/?rev=255&view=rev Author: rflament Date: 2007-02-24 02:21:38 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Added Paths: ----------- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar Removed Paths: ------------- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar Deleted: salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar =================================================================== (Binary files differ) Added: salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar =================================================================== --- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar (rev 0) +++ salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar 2007-02-24 10:21:38 UTC (rev 255) @@ -0,0 +1,851 @@ +PK + |
From: <rfl...@us...> - 2007-02-24 10:21:29
|
Revision: 254 http://svn.sourceforge.net/salto-db/?rev=254&view=rev Author: rflament Date: 2007-02-24 02:21:27 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Modified Paths: -------------- salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF Modified: salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF =================================================================== --- salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF 2007-02-24 10:21:11 UTC (rev 253) +++ salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF 2007-02-24 10:21:27 UTC (rev 254) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Salto-db Generator Eclipse Plug-in Bundle-SymbolicName: com.salto.db.generator.eclipse;singleton:=true -Bundle-Version: 1.0.14 +Bundle-Version: 1.0.15 Bundle-Activator: com.salto.db.generator.eclipse.Activator Bundle-Vendor: Salto Consulting Bundle-Localization: plugin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |