Skip to content

Commit

Permalink
Merge pull request #984 from hprange/feature/sql-server-generate-pk-f…
Browse files Browse the repository at this point in the history
…rom-sequence

Add new ERMicrosoftPlugIn supporting PK generation from sequences
  • Loading branch information
hprange authored Jul 25, 2022
2 parents 7f6249c + 2db1d55 commit a859052
Show file tree
Hide file tree
Showing 25 changed files with 831 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/.WOLips
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<dot-wolips>
<patternset name="classes exclude">
<pattern name="build.properties"/>
<pattern name="build.properties"/></patternset>
<patternset name="classes include">
<pattern name="**/*.class"/>

<pattern name="**/*.class"/><pattern name="**/*.properties"/></patternset>
<patternset name="resources exclude">
<pattern name="**/*.eomodeld~/"/>


<pattern name="**/*.eomodeld~/"/><pattern name="**/*.woa/**"/><pattern name="**/*.framework/**"/></patternset>
<patternset name="resources include">
<pattern name="**/*.eomodeld/"/>




<pattern name="**/*.eomodeld/"/><pattern name="**/*.d2wmodel"/><pattern name="**/*.wo/"/><pattern name="**/*.api"/><pattern name="**/*.strings"/></patternset>
<patternset name="woapp resources exclude">
<pattern name="**/*.woa/**"/>

<pattern name="**/*.woa/**"/><pattern name="**/*.framework/**"/></patternset>
<patternset name="woapp resources include">
<pattern name="**/*.xsl"/>





<pattern name="**/*.xsl"/><pattern name="**/*.css"/><pattern name="**/*.png"/><pattern name="**/*.jpg"/><pattern name="**/*.gif"/><pattern name="**/*.js"/></patternset>
</dot-wolips>
11 changes: 11 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="Sources"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOAccess"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOControl"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaFoundation"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaJDBCAdaptor"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="WOFramework/ERJars"/>
<classpathentry kind="output" path="bin"/>
</classpath>
6 changes: 6 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target
bin
build
*.xcodeproj
*.pbxproj
ant.*
43 changes: 43 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ERMicrosoftPlugIn</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.objectstyle.wolips.incrementalbuilder</name>
<arguments>
<dictionary>
<key>res.exclude.patterns</key>
<value>*/Thumbs.db,*/.*,*~,*~/*,*/CVS/*,/CustomInfo.plist,/build.xml</value>
</dictionary>
<dictionary>
<key>webserver.res.exclude.patterns</key>
<value>*/Thumbs.db,*/.*,*~,*~/*,*/CVS/*,/CustomInfo.plist,*/*.wo/*,*/*.eomodeld/*</value>
</dictionary>
<dictionary>
<key>webserver.res.include.patterns</key>
<value>*.js,*.css,*.jpg,*.jpeg,*.png,*.gif,*.html,/WebResources/*,*.xsl</value>
</dictionary>
<dictionary>
<key>nsprincipalclass</key>
<value></value>
</dictionary>
<dictionary>
<key>res.include.patterns</key>
<value>/Properties,*.api,*.d2wmodel,*.xml,*.plist,*.strings,/Resources/*,*/*.wo/*,*/*.eomodeld/*</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.objectstyle.wolips.incrementalframeworknature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=disabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Sep 21 16:05:00 CEST 2006
eclipse.preferences.version=1
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99
32 changes: 32 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/Documentation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>
<head><title>Microsoft SQL Server JDBC Plugin for WebObjects</title></head>
<body>

<h1>Microsoft SQL Server JDBC Plugin for WebObjects</h1>
<hr/>

<P>This framework is a plugin for WebObjects' JDBCAdaptor so that it is able to communicate with a Microsoft SQL Server database. You need to make sure that both this framework and the JDBC driver for Microsoft SQL Server are in your project's classpath. In your connection dictionary you might use values such as;</P>

<table>
<tr>
<td align="right"><i>URL</i> = </td>
<td><tt>jdbc:sqlserver://localhost:1433;databaseName=db_name;</tt></td>
</tr>
<tr>
<td align="right"><i>driver</i> = </td>
<td><tt>com.microsoft.sqlserver.jdbc.SQLServerDriver</tt></td>
</tr>
<tr>
<td align="right"><i>plugin</i> = </td>
<td><tt>ERMicrosoftPlugIn</tt></td>
</tr>
<tr>
<td align="right"><i>username</i> = </td>
<td><tt>foo</tt></td>
</tr>
</table>

<P>When the SQL is being generated for your model to populate your database server's schema, EOF will typically connect to the database server to check information about various types that the database server will support. Sometimes this is very inconvenient when you are away from direct access to the database server. For this reason, the plugin contains a hard-coded set of SQL Server types and you can specify that you want to use those by adding the <tt>?useBundledJdbcInfo=true</tt> to the end of the connection URL.</P>

</body>
</html>
17 changes: 17 additions & 0 deletions Frameworks/PlugIns/ERMicrosoftPlugIn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Improves the support for SQL Server with WebObjects.

This plugin uses sequences to generate primary keys instead of the `EO_PK_TABLE` strategy used by the standard `MicrosoftPlugIn`. It obtains the sequence name per entity according to the following algorithm:

```java
entity.primaryKeyRootName() + "_seq".
```

It throws an exception if a sequence is not found.

## Additional Setup Info

Specify these parameters in EntityModeler to connect to the SQL Server database:

- **URL**: jdbc:sqlserver://<host>:<port>;databaseName=<db_name>;[;property=value...]
- **Driver**: com.microsoft.sqlserver.jdbc.SQLServerDriver
- **Plugin**: ERMicrosoftPlugIn
Loading

0 comments on commit a859052

Please sign in to comment.