JBoss Tools SVN: r2686 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: sabrashevich
Date: 2007-07-26 11:12:21 -0400 (Thu, 26 Jul 2007)
New Revision: 2686
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
Log:
minor change
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-26 14:34:48 UTC (rev 2685)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-26 15:12:21 UTC (rev 2686)
@@ -58,11 +58,11 @@
</mediaobject>
</figure>
<orderedlist continuation="continues">
-<listitem><para>On the next step select EJB profile.</para></listitem>
+<listitem><para>On the next step select server profile.</para></listitem>
</orderedlist>
<figure>
-<title>Selecting EJB profile</title>
+<title>Selecting server profile</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ejbprofile.png"/>
17 years, 5 months
JBoss Tools SVN: r2685 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: scanner/xml and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-26 10:34:48 -0400 (Thu, 26 Jul 2007)
New Revision: 2685
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217 Implemented text position calculation for SeamProperty.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-26 14:32:15 UTC (rev 2684)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-26 14:34:48 UTC (rev 2685)
@@ -13,6 +13,8 @@
import java.util.List;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValue;
@@ -30,6 +32,18 @@
if(value != null) adopt((SeamObject)value);
}
+ public int getLength() {
+ IValueInfo info = attributes.get(ISeamXmlComponentDeclaration.NAME);
+ if(info != null) return info.getLength();
+ return 0;
+ }
+
+ public int getStartPosition() {
+ IValueInfo info = attributes.get(ISeamXmlComponentDeclaration.NAME);
+ if(info != null) return info.getStartPosition();
+ return 0;
+ }
+
public List<Change> merge(SeamObject s) {
List<Change> changes = super.merge(s);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-26 14:32:15 UTC (rev 2684)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-26 14:34:48 UTC (rev 2685)
@@ -161,6 +161,7 @@
SeamProperty p = new SeamProperty();
p.setId(xml);
+ p.setName(new XMLValueInfo(c, "&" + a.getName()));
p.setName(toCamelCase(xml, false));
SeamValueString v = new SeamValueString();
v.setId("value");
17 years, 5 months
JBoss Tools SVN: r2684 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-26 10:32:15 -0400 (Thu, 26 Jul 2007)
New Revision: 2684
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java
Log:
EXIN-217 added computation of position for attribute name
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java 2007-07-26 14:26:04 UTC (rev 2683)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java 2007-07-26 14:32:15 UTC (rev 2684)
@@ -33,10 +33,15 @@
String attribute;
int startPosition;
int endPosition;
+ boolean selectAttributeName = false;
public PositionSearcher() {}
public void init(String text, XModelObject object, String attribute) {
+ if(attribute != null && attribute.startsWith("&")) {
+ selectAttributeName = true;
+ attribute = attribute.substring(1);
+ }
this.text = text;
this.object = object;
this.attribute = attribute;
@@ -63,6 +68,12 @@
if(xml.indexOf(".") < 0) {
String s = text.substring(startPosition, endPosition);
int i1 = s.indexOf(xml);
+ if(selectAttributeName) {
+ if(i1 < 0) return;
+ startPosition = startPosition + i1;
+ endPosition = startPosition + xml.length();
+ return;
+ }
int i2 = (i1 < 0) ? -1 : s.indexOf('"', i1 + 1);
int i3 = (i2 < 0) ? -1 : s.indexOf('"', i2 + 1);
if(i3 > 0) {
17 years, 5 months
JBoss Tools SVN: r2683 - in trunk/documentation/GettingStartedGuide/docs/userguide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sabrashevich
Date: 2007-07-26 10:26:04 -0400 (Thu, 26 Jul 2007)
New Revision: 2683
Added:
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/consoleoutput.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromicon.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromserversview.png
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
Log:
http://jira.jboss.com/jira/browse/EXIN-401 a "Manage JBoss AS from Red Hat Developer Studio" chapter is improved
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/consoleoutput.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/consoleoutput.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromicon.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromicon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromserversview.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/startingfromserversview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-26 14:02:05 UTC (rev 2682)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-26 14:26:04 UTC (rev 2683)
@@ -15,7 +15,7 @@
<?dbhtml filename="JBossInstalling.html"?>
<title>JBoss AS Installation</title>
<para>If you followed the default installation of Red Hat Developer Studio, you will already have a JBoss 4.2 server installed and defined. You have to do nothing to deploy your project. Just start JBoss server using a JBoss icon from command panel and launch your application. Registration to default JBoss AS is being done when you are creating an appication, in the second screen of wizard called "Web" ("Target Server" section). Simply do not uncheck the control in this section.</para>
-<para>Besides that you can deploy your application to some servers that Red Hat Developer Studio supports directly (through the bundled Eclipse WTP plug-ins). Say you want to deploy the application to JBoss 4.0.5 server. First of all you need to install it.</para>
+<para>Besides that you can deploy your application to some servers that Red Hat Developer Studio supports directly (through the bundled Eclipse WTP plug-ins). Suppose you want to deploy the application to JBoss 4.0.5 server. First of all you need to install it.</para>
<orderedlist>
<listitem><para>Download the installation pack of JBoss 4.0.5 and save it on your computer: <ulink url="http://labs.jboss.com/jbossas/downloads">http://labs.jboss.com/jbossas/downloads</ulink></para></listitem>
<listitem><para>Double-click this file or launch the installation from terminal like this:</para></listitem>
@@ -159,4 +159,42 @@
</para></listitem>
</orderedlist>
</section>
+
+ <section id="StartingServer">
+ <?dbhtml filename="StartingServer.html"?>
+ <title>Starting and stopping JBoss server</title>
+ <para>Starting JBoss server is quite simple. Red Hat Developer Studio allows you control its behaviour through a special toolbar: start it in regular or debug mode, stop it, or restart it.</para>
+ <orderedlist>
+ <listitem><para>To launch the server click the green colored icon on the panel or right click server name in Servers view and select "Start":</para></listitem>
+ </orderedlist>
+ <figure>
+<title>Starting from icon</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/startingfromicon.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+
+<figure>
+<title>Starting from Servers view</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/startingfromserversview.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>To stop the server click the button "Stop".</para></listitem>
+</orderedlist>
+<para>While launching Server output will be written to the Console view:</para>
+<figure>
+<title>Console output</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/consoleoutput.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+ </section>
</chapter>
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2682 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-26 10:02:05 -0400 (Thu, 26 Jul 2007)
New Revision: 2682
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Fix bug with "property" validation
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-26 13:59:11 UTC (rev 2681)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-26 14:02:05 UTC (rev 2682)
@@ -391,7 +391,7 @@
return;
}
validationContext.addLinkedCoreResource(componentName, declaration.getSourcePath());
- String className = declaration.getClassName();
+ String className = component.getClassName();
if(className!=null) {
IType type = null;
// validate class name
17 years, 5 months
JBoss Tools SVN: r2681 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-26 09:59:11 -0400 (Thu, 26 Jul 2007)
New Revision: 2681
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-26 13:57:14 UTC (rev 2680)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-26 13:59:11 UTC (rev 2681)
@@ -22,8 +22,8 @@
public static final String SHOW_REFERENCES = "show references";
- protected boolean refHide = false;
- protected boolean first=true;
+ protected boolean refHide = true;
+ protected boolean first=false;
private OrmShape reference=null;
17 years, 5 months
JBoss Tools SVN: r2680 - in trunk/seam/tests/org.jboss.tools.seam.core.test: src/org/jboss/tools/seam/core/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-26 09:57:14 -0400 (Thu, 26 Jul 2007)
New Revision: 2680
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
EXIN-336 More tests added.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2007-07-26 13:55:54 UTC (rev 2679)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2007-07-26 13:57:14 UTC (rev 2680)
@@ -9,4 +9,20 @@
</property>
</component>
<core:managed-persistence-context name="myPersistenceContext1"/>
+
+ <core:resource-bundle>
+ <core:bundle-names>
+ <value>bundleA</value>
+ <value>bundleB</value>
+ </core:bundle-names>
+ </core:resource-bundle>
+
+ <core:manager
+ conversation-is-long-running-parameter="a"
+ parent-conversation-id-parameter="b"
+ conversation-id-parameter="c"
+ concurrent-request-timeout="2"
+ conversation-timeout="3"
+ />
+
</components>
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-07-26 13:55:54 UTC (rev 2679)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-07-26 13:57:14 UTC (rev 2680)
@@ -30,6 +30,7 @@
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamCoreBuilder;
import org.jboss.tools.seam.core.event.ISeamValueList;
+import org.jboss.tools.seam.core.event.ISeamValueString;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
@@ -213,7 +214,70 @@
ScopeType scope = c.getScope();
assertTrue("Component myPersistenceContext1 has scope=" + (scope == null ? null : scope.getLabel()) + ", but has to have " + ScopeType.CONVERSATION.getLabel(), ScopeType.CONVERSATION == scope);
+ //2. components.xml has entry
+ //<core:resource-bundle>
+ // <core:bundle-names>
+ // <value>bundleA</value>
+ // <value>bundleB</value>
+ // </core:bundle-names>
+ //</core:resource-bundle>
+ // check that
+ // a) component org.jboss.seam.core.resourceBundle exists,
+ // b) getClassName returns org.jboss.seam.core.ResourceBundle
+ // c) it has property bundleNames as list with two specified values.
+ c = seamProject.getComponent("org.jboss.seam.core.resourceBundle");
+ assertNotNull("Component org.jboss.seam.core.resourceBundle not found.", c);
+ String className = c.getClassName();
+ assertTrue("Class name of org.jboss.seam.core.resourceBundle must be "
+ + "org.jboss.seam.core.ResourceBundle "
+ + " rather than " + className, "org.jboss.seam.core.ResourceBundle".equals(className));
+ List<ISeamProperty> bundleNamesPropertyList = c.getProperties("bundleNames");
+ assertTrue("Property bundleNames is not found", bundleNamesPropertyList != null && bundleNamesPropertyList.size() == 1);
+ ISeamProperty bundleNamesProperty = bundleNamesPropertyList.get(0);
+ assertTrue("Value of bundleNames must be instanceof ISeamValueList", (bundleNamesProperty.getValue() instanceof ISeamValueList));
+ ISeamValueList bundleNames = (ISeamValueList)bundleNamesProperty.getValue();
+ List<ISeamValueString> valueList = bundleNames.getValues();
+ assertTrue("There must be 2 bundle names rather than " + valueList.size(), valueList.size() == 2);
+ assertTrue("First bundle name is " + valueList.get(0).getValue().getValue() + " rather than bundleA"
+ , "bundleA".equals(valueList.get(0).getValue().getValue()));
+ assertTrue("Second bundle name is " + valueList.get(1).getValue().getValue() + " rather than bundleB"
+ , "bundleB".equals(valueList.get(1).getValue().getValue()));
+
+ //3. components.xml has entry
+ // <core:manager
+ // conversation-is-long-running-parameter="a"
+ // parent-conversation-id-parameter="b"
+ // conversation-id-parameter="c"
+ // concurrent-request-timeout="2"
+ // conversation-timeout="3"
+ // />
+ // check that
+ // a) component org.jboss.seam.core.manager exists,
+ // b) specified properties are loaded correctly
+
+ String[][] managerTestProperties = new String[][]{
+ {"conversationIsLongRunningParameter", "a"},
+ {"parentConversationIdParameter", "b"},
+ {"conversationIdParameter", "c"},
+ {"concurrentRequestTimeout", "2"},
+ {"conversationTimeout", "3"}
+ };
+
+ c = seamProject.getComponent("org.jboss.seam.core.manager");
+ assertNotNull("Component org.jboss.seam.core.manager not found.", c);
+
+ for (int p = 0; p < managerTestProperties.length; p++) {
+ String propertyName = managerTestProperties[p][0];
+ String expectedValue = managerTestProperties[p][1];
+ List<ISeamProperty> ps = c.getProperties(propertyName);
+ assertTrue("Property " + propertyName + " is not found", ps != null && ps.size() == 1);
+ ISeamProperty property = ps.get(0);
+ ISeamValueString valueObject = (ISeamValueString)property.getValue();
+ String actualValue = valueObject.getValue().getValue();
+ assertTrue("Property " + propertyName + " has value " + actualValue + " rather than " + expectedValue, expectedValue.equals(actualValue));
+ }
+
}
}
17 years, 5 months
JBoss Tools SVN: r2679 - trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-26 09:55:54 -0400 (Thu, 26 Jul 2007)
New Revision: 2679
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta
Log:
EXIN-217 Incorrect default name removed.
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta 2007-07-26 13:53:29 UTC (rev 2678)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta 2007-07-26 13:55:54 UTC (rev 2679)
@@ -649,8 +649,7 @@
<Constraint/>
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute PROPERTIES="id=true;category=general"
- default="org.jboss.seam.core.managedPersistenceContext" name="name" xmlname="name">
+ <XModelAttribute PROPERTIES="id=true;category=general" name="name" xmlname="name">
<Constraint/>
<Editor/>
</XModelAttribute>
17 years, 5 months
JBoss Tools SVN: r2678 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-26 09:53:29 -0400 (Thu, 26 Jul 2007)
New Revision: 2678
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217 names of properties loaded from xml attributes are 'camelized' as it is done in seam
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-26 13:44:25 UTC (rev 2677)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-26 13:53:29 UTC (rev 2678)
@@ -12,6 +12,7 @@
import java.util.HashSet;
import java.util.Set;
+import java.util.StringTokenizer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -160,7 +161,7 @@
SeamProperty p = new SeamProperty();
p.setId(xml);
- p.setName(xml);
+ p.setName(toCamelCase(xml, false));
SeamValueString v = new SeamValueString();
v.setId("value");
p.setValue(v);
@@ -175,6 +176,9 @@
SeamProperty p = new SeamProperty();
p.setId(properties[j]);
p.setName(new XMLValueInfo(properties[j], "name"));
+ String name = properties[j].getAttributeValue("name");
+ String cname = toCamelCase(name, false);
+ if(!cname.equals(name)) p.setName(cname);
if(entity.getAttribute("value") != null) {
//this is simple value;
@@ -275,14 +279,37 @@
if(d < 0) return null;
String namespace = s.substring(0, d);
String tag = s.substring(d + 1);
- String className = "org.jboss.seam." + namespace + ".";
- String[] parts = tag.split("-");
- if(parts != null) for (int i = 0; i < parts.length; i++) {
- if(parts[i].length() < 1) continue;
- String p = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1);
- className += p;
- }
+ String className = "org.jboss.seam." + namespace + "." + toCamelCase(tag, true);
return className;
}
+ /**
+ * Copied from org.jboss.seam.init.Initialization
+ * @param hyphenated
+ * @param initialUpper
+ * @return
+ */
+ private static String toCamelCase(String hyphenated, boolean initialUpper)
+ {
+ StringTokenizer tokens = new StringTokenizer(hyphenated, "-");
+ StringBuilder result = new StringBuilder( hyphenated.length() );
+ String firstToken = tokens.nextToken();
+ if (initialUpper)
+ {
+ result.append( Character.toUpperCase( firstToken.charAt(0) ) )
+ .append( firstToken.substring(1) );
+ }
+ else
+ {
+ result.append(firstToken);
+ }
+ while ( tokens.hasMoreTokens() )
+ {
+ String token = tokens.nextToken();
+ result.append( Character.toUpperCase( token.charAt(0) ) )
+ .append( token.substring(1) );
+ }
+ return result.toString();
+ }
+
}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2677 - in trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping: lob and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-26 09:44:25 -0400 (Thu, 26 Jul 2007)
New Revision: 2677
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobHolder.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobMappings.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/SerializableData.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/SessionAttribute.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Item.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Part.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Product.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/ProductPart.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Document.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/DocumentInterceptor.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Folder.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/SecureDocument.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Salesperson.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Child.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Org.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.java
Log:
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobHolder.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobHolder.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobHolder.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,90 @@
+package mapping.lob;
+
+import java.io.Serializable;
+import java.sql.Clob;
+import java.sql.Blob;
+
+/**
+ * An entity containing all kinds of good LOB-type data...
+ * <p/>
+ * {@link #serialData} is used to hold general serializable data which is
+ * mapped via the {@link org.hibernate.type.SerializableType}.
+ * <p/>
+ * {@link #materializedClob} is used to hold CLOB data that is materialized
+ * into a String immediately; it is mapped via the
+ * {@link org.hibernate.type.TextType}.
+ * <p/>
+ * {@link #clobLocator} is used to hold CLOB data that is materialized lazily
+ * via a JDBC CLOB locator; it is mapped via the
+ * {@link org.hibernate.type.ClobType}
+ * <p/>
+ * {@link #materializedBlob} is used to hold BLOB data that is materialized
+ * into a byte array immediately; it is mapped via the
+ * {@link org.hibernate.test.lob.MaterializedBlobType}.
+ * <p/>
+ * {@link #blobLocator} is used to hold BLOB data that is materialized lazily
+ * via a JDBC BLOB locator; it is mapped via the
+ * {@link org.hibernate.type.BlobType}
+ *
+ *
+ * @author Steve Ebersole
+ */
+public class LobHolder {
+ private Long id;
+
+ private Serializable serialData;
+
+ private String materializedClob;
+ private Clob clobLocator;
+
+ private byte[] materializedBlob;
+ private Blob blobLocator;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Serializable getSerialData() {
+ return serialData;
+ }
+
+ public void setSerialData(Serializable serialData) {
+ this.serialData = serialData;
+ }
+
+ public String getMaterializedClob() {
+ return materializedClob;
+ }
+
+ public void setMaterializedClob(String materializedClob) {
+ this.materializedClob = materializedClob;
+ }
+
+ public Clob getClobLocator() {
+ return clobLocator;
+ }
+
+ public void setClobLocator(Clob clobLocator) {
+ this.clobLocator = clobLocator;
+ }
+
+ public byte[] getMaterializedBlob() {
+ return materializedBlob;
+ }
+
+ public void setMaterializedBlob(byte[] materializedBlob) {
+ this.materializedBlob = materializedBlob;
+ }
+
+ public Blob getBlobLocator() {
+ return blobLocator;
+ }
+
+ public void setBlobLocator(Blob blobLocator) {
+ this.blobLocator = blobLocator;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobMappings.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobMappings.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/LobMappings.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.lob">
+
+ <class name="LobHolder" table="LOB_ENTITY">
+ <id name="id" type="long" column="ID">
+ <generator class="increment"/>
+ </id>
+
+ <property name="serialData" column="SER_DATA" type="serializable"/>
+
+ <property name="materializedClob" column="MAT_CLOB_DATA" type="text" length="15000"/>
+ <property name="clobLocator" column="CLOB_DATA" type="clob" length="15000" />
+
+ <property name="materializedBlob" column="MAT_BLOB_DATA" type="org.hibernate.test.lob.MaterializedBlobType" length="15000"/>
+ <property name="blobLocator" column="BLOB_DATA" type="blob" length="15000" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/SerializableData.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/SerializableData.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/lob/SerializableData.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,29 @@
+// $Id: SerializableData.java 4704 2004-11-04 21:59:22Z steveebersole $
+package mapping.lob;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of SerializableData.
+ *
+ * @author Steve
+ */
+public class SerializableData implements Serializable
+{
+ private String payload;
+
+ public SerializableData(String payload)
+ {
+ this.payload = payload;
+ }
+
+ public String getPayload()
+ {
+ return payload;
+ }
+
+ public void setPayload(String payload)
+ {
+ this.payload = payload;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/Group.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,56 @@
+//$Id: Group.java 7085 2005-06-08 17:59:47Z oneovthafew $
+package mapping.manytomany;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Group implements Serializable {
+
+ private String org;
+ private String name;
+ private String description;
+
+ private Set users = new HashSet();
+
+ public Group(String name, String org) {
+ this.org = org;
+ this.name = name;
+ }
+
+ public Group() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public Set getUsers() {
+ return users;
+ }
+
+ public void setUsers(Set users) {
+ this.users = users;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,46 @@
+//$Id: User.java 7085 2005-06-08 17:59:47Z oneovthafew $
+package mapping.manytomany;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+public class User implements Serializable {
+
+ private String org;
+ private String name;
+ private Set groups = new HashSet();
+
+ public User(String name, String org) {
+ this.org = org;
+ this.name = name;
+ }
+
+ public User() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public Set getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Set groups) {
+ this.groups = groups;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/UserGroup.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates how to map a many-to-many
+ association with a shared attribute in the primary keys
+ of the associated entities.
+
+-->
+
+<hibernate-mapping
+ package="mapping.manytomany">
+
+ <class name="User" table="`User`">
+ <composite-id>
+ <key-property name="name"/>
+ <key-property name="org"/>
+ </composite-id>
+ <set name="groups" table="UserGroup">
+ <key>
+ <column name="userName"/>
+ <column name="org"/>
+ </key>
+ <many-to-many class="Group">
+ <column name="groupName"/>
+ <formula>org</formula>
+ </many-to-many>
+ </set>
+ </class>
+
+ <class name="Group" table="`Group`">
+ <composite-id>
+ <key-property name="name"/>
+ <key-property name="org"/>
+ </composite-id>
+ <property name="description"/>
+ <set name="users" table="UserGroup" inverse="true">
+ <key>
+ <column name="groupName"/>
+ <column name="org"/>
+ </key>
+ <many-to-many class="User">
+ <column name="userName"/>
+ <formula>org</formula>
+ </many-to-many>
+ </set>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/Group.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,69 @@
+package mapping.manytomany.ordered;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+public class Group implements Serializable {
+
+ private Long id;
+ private String org;
+ private String name;
+ private String description;
+
+ private List users = new ArrayList();
+
+ public Group() {
+ }
+
+ public Group(String name, String org) {
+ this.org = org;
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public List getUsers() {
+ return users;
+ }
+
+ public void setUsers(List users) {
+ this.users = users;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void addUser(User user) {
+ if ( user.getGroups().add( this ) ) {
+ getUsers().add( user );
+ }
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,54 @@
+package mapping.manytomany.ordered;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.HashSet;
+
+public class User implements Serializable {
+
+ private Long id;
+ private String org;
+ private String name;
+ private Set groups = new HashSet();
+
+ public User() {
+ }
+
+ public User(String name, String org) {
+ this.org = org;
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public Set getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Set groups) {
+ this.groups = groups;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/manytomany/ordered/UserGroup.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates how to map a many-to-many
+ association with a shared attribute in the primary keys
+ of the associated entities.
+
+-->
+
+<hibernate-mapping
+ package="mapping.manytomany.ordered">
+
+
+ <class name="User" table="`User`">
+ <id name="id" column="ID" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="name" column="NAME"/>
+ <property name="org" column="ORG"/>
+ <set name="groups" table="UserGroup">
+ <key column="USER_ID"/>
+ <many-to-many column="GROUP_ID" class="Group"/>
+ </set>
+ </class>
+
+ <class name="Group" table="`Group`">
+ <id name="id" column="ID">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <property name="description"/>
+ <bag name="users" table="UserGroup" inverse="true">
+ <key column="GROUP_ID"/>
+ <many-to-many column="USER_ID" class="User" order-by="NAME"/>
+ </bag>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/Group.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,29 @@
+//$Id: Group.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class Group {
+ private String name;
+ private Map users = new HashMap();
+ Group() {}
+ public Group(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Map getUsers() {
+ return users;
+ }
+ public void setUsers(Map users) {
+ this.users = users;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/SessionAttribute.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/SessionAttribute.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/SessionAttribute.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,41 @@
+//$Id: SessionAttribute.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.map;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class SessionAttribute {
+ private Long id;
+ private String name;
+ private String stringData;
+ private Serializable objectData;
+ SessionAttribute() {}
+ public SessionAttribute(String name, Serializable obj) {
+ this.name = name;
+ this.objectData = obj;
+ }
+ public SessionAttribute(String name, String str) {
+ this.name = name;
+ this.stringData = str;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Serializable getObjectData() {
+ return objectData;
+ }
+ public void setObjectData(Serializable objectData) {
+ this.objectData = objectData;
+ }
+ public String getStringData() {
+ return stringData;
+ }
+ public void setStringData(String stringData) {
+ this.stringData = stringData;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,37 @@
+//$Id: User.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String name;
+ private String password;
+ private Map session = new HashMap();
+ User() {}
+ public User(String n, String pw) {
+ name=n;
+ password = pw;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public Map getSession() {
+ return session;
+ }
+ public void setSession(Map session) {
+ this.session = session;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/map/UserGroup.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.map">
+
+ <class name="Group" table="groups">
+ <id name="name"/>
+ <map name="users" cascade="persist" table="group_user">
+ <key column="groupName"/>
+ <map-key formula="lower(personName)" type="string"/>
+ <many-to-many column="personName" class="User"/>
+ </map>
+ </class>
+
+ <class name="User" table="users">
+ <id name="name"/>
+ <property name="password"/>
+ <map name="session" cascade="persist,save-update,delete,delete-orphan">
+ <key column="userName" not-null="true"/>
+ <map-key formula="lower(name)" type="string"/>
+ <one-to-many class="SessionAttribute"/>
+ </map>
+ </class>
+
+ <class name="SessionAttribute" table="session_attributes">
+ <id name="id" access="field">
+ <generator class="native"/>
+ </id>
+ <property name="name" not-null="true" update="false"/>
+ <property name="stringData"/>
+ <property name="objectData"/>
+ </class>
+
+ <sql-query name="userSessionData">
+ <return alias="u" class="User"/>
+ <return-join alias="s" property="u.session"/>
+ select
+ lower(u.name) as {u.name}, lower(u.password) as {u.password},
+ lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element},
+ {s.element.*}
+ from users u
+ join session_attributes s on lower(s.userName) = lower(u.name)
+ where u.name like :uname
+ </sql-query>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Item.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Item.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Item.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,35 @@
+//$Id: Item.java 6236 2005-03-29 03:20:23Z oneovthafew $
+package mapping.mapcompelem;
+
+/**
+ * @author Gavin King
+ */
+public class Item {
+
+ private String code;
+ private Product product;
+
+
+ Item() {}
+ public Item(String code, Product p) {
+ this.code = code;
+ this.product = p;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public Product getProduct() {
+ return product;
+ }
+
+ public void setProduct(Product product) {
+ this.product = product;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Part.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Part.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Part.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,37 @@
+//$Id: Part.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.mapcompelem;
+
+
+/**
+ * @author Gavin King
+ */
+public class Part {
+ private String name;
+ private String description;
+ Part() {}
+ public Part(String n, String pw) {
+ name=n;
+ description = pw;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String password) {
+ this.description = password;
+ }
+ public boolean equals(Object that) {
+ return ( (Part) that ).getName().equals(name);
+ }
+ public int hashCode() {
+ return name.hashCode();
+ }
+ public String toString() {
+ return name + ":" + description;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Product.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Product.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/Product.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,29 @@
+//$Id: Product.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.mapcompelem;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class Product {
+ private String name;
+ private Map parts = new HashMap();
+ Product() {}
+ public Product(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Map getParts() {
+ return parts;
+ }
+ public void setParts(Map users) {
+ this.parts = users;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/ProductPart.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/ProductPart.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapcompelem/ProductPart.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.mapcompelem">
+
+ <import class="Part"/>
+
+ <class name="Product" table="Products">
+ <id name="name" column="productName"/>
+ <map name="parts" table="Parts">
+ <key column="productName"/>
+ <map-key column="partName" type="string"/>
+ <composite-element class="Part">
+ <property name="name" formula="lower(partName)"/>
+ <property name="description" column="partDescription"/>
+ </composite-element>
+ </map>
+ </class>
+
+ <class name="Item" table="Items">
+ <id name="code"/>
+ <many-to-one name="product" column="productName"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/Group.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,29 @@
+//$Id: Group.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.mapelemformula;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class Group {
+ private String name;
+ private Map users = new HashMap();
+ Group() {}
+ public Group(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Map getUsers() {
+ return users;
+ }
+ public void setUsers(Map users) {
+ this.users = users;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,28 @@
+//$Id: User.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.mapelemformula;
+
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String name;
+ private String password;
+ User() {}
+ public User(String n, String pw) {
+ name=n;
+ password = pw;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mapelemformula/UserGroup.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.mapelemformula">
+
+ <class name="Group" table="groups">
+ <id name="name"/>
+ <map name="users" cascade="persist" table="group_user">
+ <key column="groupName"/>
+ <map-key column="personName" type="string"/>
+ <many-to-many formula="lower(personName)" class="User" fetch="select"/>
+ </map>
+ </class>
+
+ <class name="User" table="users">
+ <id name="name"/>
+ <property name="password"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+This File Intentionally Left Blank
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/InvalidMapping.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,5 @@
+package mapping.mappingexception;
+
+public class InvalidMapping {
+// This Class Intentionally Left Blank
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.mappingexception" >
+ <class name="User" table="T_USER" >
+ <id name="id" unsaved-value="null" column="user_id" >
+ <generator class="native"/>
+ </id>
+ <property name="username" type="string" column="user_name" />
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mappingexception/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,31 @@
+// $Id: User.java 4746 2004-11-11 20:57:28Z steveebersole $
+package mapping.mappingexception;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ *
+ *
+ * @author Max Rydahl Andersen
+ */
+public class User {
+ private Long id;
+ private String username;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Document.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Document.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Document.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,83 @@
+//$Id: Document.java 8670 2005-11-25 17:36:29Z epbernard $
+
+package mapping.mixed;
+
+
+import java.sql.Blob;
+import java.util.Calendar;
+
+
+/**
+ * @author Gavin King
+ */
+
+public class Document extends Item {
+
+ private Blob content;
+
+ private Calendar modified;
+
+ private Calendar created;
+
+ /**
+ * @return Returns the created.
+ */
+
+ public Calendar getCreated() {
+
+ return created;
+
+ }
+
+ /**
+ * @param created The created to set.
+ */
+
+ public void setCreated(Calendar created) {
+
+ this.created = created;
+
+ }
+
+ /**
+ * @return Returns the modified.
+ */
+
+ public Calendar getModified() {
+
+ return modified;
+
+ }
+
+ /**
+ * @param modified The modified to set.
+ */
+
+ public void setModified(Calendar modified) {
+
+ this.modified = modified;
+
+ }
+
+ /**
+ * @return Returns the content.
+ */
+
+ public Blob getContent() {
+
+ return content;
+
+ }
+
+ /**
+ * @param content The content to set.
+ */
+
+ public void setContent(Blob content) {
+
+ this.content = content;
+
+ }
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/DocumentInterceptor.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/DocumentInterceptor.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/DocumentInterceptor.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,116 @@
+//$Id: DocumentInterceptor.java 8670 2005-11-25 17:36:29Z epbernard $
+package mapping.mixed;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Iterator;
+
+import org.hibernate.CallbackException;
+import org.hibernate.EntityMode;
+import org.hibernate.Interceptor;
+import org.hibernate.Transaction;
+import org.hibernate.type.Type;
+
+/**
+ * @author Gavin King
+ */
+public class DocumentInterceptor implements Interceptor {
+
+
+ public boolean onLoad(
+ Object entity, Serializable id, Object[] state,
+ String[] propertyNames, Type[] types
+ ) throws CallbackException {
+ return false;
+ }
+
+ public boolean onFlushDirty(
+ Object entity, Serializable id,
+ Object[] currentState, Object[] previousState,
+ String[] propertyNames, Type[] types
+ ) throws CallbackException {
+ if ( entity instanceof Document ) {
+ currentState[3] = Calendar.getInstance();
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public boolean onSave(
+ Object entity, Serializable id, Object[] state,
+ String[] propertyNames, Type[] types
+ ) throws CallbackException {
+ if ( entity instanceof Document ) {
+ state[4] = state[3] = Calendar.getInstance();
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public void onDelete(
+ Object entity, Serializable id, Object[] state,
+ String[] propertyNames, Type[] types
+ ) throws CallbackException {
+
+ }
+
+ public void preFlush(Iterator entities) throws CallbackException {
+
+ }
+
+ public void postFlush(Iterator entities) throws CallbackException {
+
+ }
+
+ public Boolean isTransient(Object entity) {
+ return null;
+ }
+
+ public int[] findDirty(
+ Object entity, Serializable id,
+ Object[] currentState, Object[] previousState,
+ String[] propertyNames, Type[] types
+ ) {
+ return null;
+ }
+
+ public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
+ return null;
+ }
+
+ public String getEntityName(Object object) throws CallbackException {
+ return null;
+ }
+
+ public Object getEntity(String entityName, Serializable id)
+ throws CallbackException {
+ return null;
+ }
+
+ public void afterTransactionBegin(Transaction tx) {
+ }
+
+ public void afterTransactionCompletion(Transaction tx) {
+ }
+
+ public void beforeTransactionCompletion(Transaction tx) {
+ }
+
+ public String onPrepareStatement(String sql) {
+ return sql;
+ }
+
+ public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {
+ }
+
+ public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {
+ }
+
+ public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Folder.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Folder.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Folder.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,13 @@
+//$Id: Folder.java 8670 2005-11-25 17:36:29Z epbernard $
+
+package mapping.mixed;
+
+
+/**
+ * @author Gavin King
+ */
+
+public class Folder extends Item {
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+
+<!--
+
+
+
+ This mapping demonstrates a mixed inheritance strategy,
+
+ with one subclass acting like a joined-subclass via
+
+ use of a <join>. Also notice the fields which are initialized
+
+ by an interceptor.
+
+
+
+-->
+
+
+<hibernate-mapping
+
+ package="mapping.mixed">
+
+
+ <class name="Item"
+
+ table="Files"
+
+ discriminator-value="I">
+
+
+ <id name="id">
+
+ <generator class="native"/>
+
+ </id>
+
+
+ <discriminator type="character"
+
+ column="itemType"/>
+
+
+ <property name="name">
+
+ <column name="name"
+
+ not-null="true"
+
+ />
+ <!--unique-key="folder-parent"-->
+
+ </property>
+
+
+ <many-to-one name="parent"
+
+ class="Folder">
+
+ <column name="parentFolderId"
+
+ />
+ <!--unique-key="folder-parent"-->
+
+ </many-to-one>
+
+
+ <subclass name="Document"
+
+ discriminator-value="D"
+
+ lazy="true"
+
+ dynamic-update="true">
+
+
+ <property name="content"/>
+
+
+ <!-- managed by DocumentInterceptor -->
+
+ <property name="modified"/>
+
+ <property name="created"/>
+
+
+ <subclass name="SecureDocument"
+
+ discriminator-value="S"
+
+ dynamic-update="true"
+
+ lazy="true">
+
+
+ <join table="SecureDocument">
+
+
+ <key column="documentId"/>
+
+
+ <property name="permissionBits"
+
+ not-null="true"/>
+
+ <property name="owner"
+
+ not-null="true"/>
+
+
+ </join>
+
+
+ </subclass>
+
+
+ </subclass>
+
+
+ <subclass name="Folder"
+
+ discriminator-value="F"/>
+
+
+ </class>
+
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/Item.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,79 @@
+//$Id: Item.java 8670 2005-11-25 17:36:29Z epbernard $
+
+package mapping.mixed;
+
+
+/**
+ * @author Gavin King
+ */
+
+public abstract class Item {
+
+ private Long id;
+
+ private String name;
+
+ private Folder parent;
+
+ /**
+ * @return Returns the parent.
+ */
+
+ public Folder getParent() {
+
+ return parent;
+
+ }
+
+ /**
+ * @param parent The parent to set.
+ */
+
+ public void setParent(Folder parent) {
+
+ this.parent = parent;
+
+ }
+
+ /**
+ * @return Returns the id.
+ */
+
+ public Long getId() {
+
+ return id;
+
+ }
+
+ /**
+ * @param id The id to set.
+ */
+
+ public void setId(Long id) {
+
+ this.id = id;
+
+ }
+
+ /**
+ * @return Returns the name.
+ */
+
+ public String getName() {
+
+ return name;
+
+ }
+
+ /**
+ * @param name The name to set.
+ */
+
+ public void setName(String name) {
+
+ this.name = name;
+
+ }
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/SecureDocument.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/SecureDocument.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/mixed/SecureDocument.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,57 @@
+//$Id: SecureDocument.java 8670 2005-11-25 17:36:29Z epbernard $
+
+package mapping.mixed;
+
+
+/**
+ * @author Gavin King
+ */
+
+public class SecureDocument extends Document {
+
+ private byte permissionBits;
+
+ private String owner;
+
+ /**
+ * @return Returns the owner.
+ */
+
+ public String getOwner() {
+
+ return owner;
+
+ }
+
+ /**
+ * @param owner The owner to set.
+ */
+
+ public void setOwner(String owner) {
+
+ this.owner = owner;
+
+ }
+
+ /**
+ * @return Returns the permissionBits.
+ */
+
+ public byte getPermissionBits() {
+
+ return permissionBits;
+
+ }
+
+ /**
+ * @param permissionBits The permissionBits to set.
+ */
+
+ public void setPermissionBits(byte permissionBits) {
+
+ this.permissionBits = permissionBits;
+
+ }
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping illustrates use of <natural-id>.
+
+-->
+
+<hibernate-mapping
+ package="mapping.naturalid"
+ default-access="field">
+
+ <class name="User" table="SystemUserInfo">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <natural-id>
+ <property name="name"/>
+ <property name="org"/>
+ </natural-id>
+ <property name="password"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/naturalid/User.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,34 @@
+//$Id: User.java 6900 2005-05-25 01:24:22Z oneovthafew $
+package mapping.naturalid;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+
+ private Long id;
+ private String name;
+ private String org;
+ private String password;
+
+ User() {}
+
+ public User(String name, String org, String password) {
+ this.name = name;
+ this.org = org;
+ this.password = password;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Address.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Address.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Address.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,11 @@
+//$Id: Address.java 7119 2005-06-12 22:03:30Z oneovthafew $
+package mapping.ondelete;
+
+/**
+ * @author Gavin King
+ */
+public class Address {
+ public String address;
+ public String zip;
+ public String country;
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Employee.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,49 @@
+//$Id: Employee.java 7119 2005-06-12 22:03:30Z oneovthafew $
+package mapping.ondelete;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Gavin King
+ */
+public class Employee extends Person {
+ private String title;
+ private BigDecimal salary;
+ private Employee manager;
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return Returns the manager.
+ */
+ public Employee getManager() {
+ return manager;
+ }
+ /**
+ * @param manager The manager to set.
+ */
+ public void setManager(Employee manager) {
+ this.manager = manager;
+ }
+ /**
+ * @return Returns the salary.
+ */
+ public BigDecimal getSalary() {
+ return salary;
+ }
+ /**
+ * @param salary The salary to set.
+ */
+ public void setSalary(BigDecimal salary) {
+ this.salary = salary;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates the use of database-level
+ cascade delete.
+
+-->
+
+<hibernate-mapping
+ package="mapping.ondelete"
+ default-access="field">
+
+ <class name="Person" table="ODPerson">
+
+ <id name="id"
+ column="person_id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name"
+ not-null="true"
+ length="80"/>
+ <property name="sex"
+ not-null="true"
+ update="false"/>
+
+ <component name="address">
+ <property name="address"/>
+ <property name="zip"/>
+ <property name="country"/>
+ </component>
+
+ <many-to-one name="salesperson"
+ column="salesperson_id"/>
+
+ <joined-subclass name="Employee" table="ODEmployee">
+ <key column="person_id"
+ on-delete="cascade"/>
+ <property name="title"
+ not-null="true"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+
+ <joined-subclass name="Salesperson" table="ODSalesperson">
+ <key column="employee_id"
+ on-delete="cascade"/>
+ <set name="customers"
+ inverse="true"
+ cascade="all">
+ <key column="salesperson_id"
+ on-delete="cascade"/>
+ <one-to-many class="Person"/>
+ </set>
+ </joined-subclass>
+
+ </joined-subclass>
+
+ </class>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Person.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,79 @@
+//$Id: Person.java 7119 2005-06-12 22:03:30Z oneovthafew $
+package mapping.ondelete;
+
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+ private long id;
+ private String name;
+ private char sex;
+ private Address address = new Address();
+ private Salesperson salesperson;
+ /**
+ * @return Returns the address.
+ */
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(String string) {
+ this.address.address = string;
+ }
+
+ public void setZip(String string) {
+ this.address.zip = string;
+ }
+
+ public void setCountry(String string) {
+ this.address.country = string;
+ }
+
+
+ /**
+ * @return Returns the sex.
+ */
+ public char getSex() {
+ return sex;
+ }
+ /**
+ * @param sex The sex to set.
+ */
+ public void setSex(char sex) {
+ this.sex = sex;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the identity.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param identity The identity to set.
+ */
+ public void setName(String identity) {
+ this.name = identity;
+ }
+
+ public Salesperson getSalesperson() {
+ return salesperson;
+ }
+
+ public void setSalesperson(Salesperson salesperson) {
+ this.salesperson = salesperson;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Salesperson.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Salesperson.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ondelete/Salesperson.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,18 @@
+//$Id: Salesperson.java 7119 2005-06-12 22:03:30Z oneovthafew $
+package mapping.ondelete;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Salesperson extends Employee {
+ private Set customers = new HashSet();
+
+ public Set getCustomers() {
+ return customers;
+ }
+
+ public void setCustomers(Set customers) {
+ this.customers = customers;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Child.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Child.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Child.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,47 @@
+//$Id: Child.java 4378 2004-08-19 10:12:11Z oneovthafew $
+package mapping.onetomany;
+
+/**
+ * @author gavin
+ */
+public class Child {
+ private Long id;
+ private String name;
+ private Parent parent;
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the parent.
+ */
+ public Parent getParent() {
+ return parent;
+ }
+ /**
+ * @param parent The parent to set.
+ */
+ public void setParent(Parent parent) {
+ this.parent = parent;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates how to use an "inverse" join
+ to map an association table as an association with
+ one-to-many multiplicity at the level of the object
+ model.
+
+-->
+
+<hibernate-mapping
+ package="mapping.onetomany">
+
+ <class name="Parent">
+ <id name="id"
+ column="parent_id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <set name="children"
+ table="ParentChild"
+ cascade="all"
+ inverse="true">
+ <key column="parent_id"/>
+ <many-to-many column="child_id"
+ class="Child"/>
+ </set>
+ </class>
+
+ <class name="Child">
+ <id name="id"
+ column="child_id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <join table="ParentChild"
+ optional="true">
+ <key column="child_id"/>
+ <many-to-one name="parent"
+ column="parent_id"
+ not-null="true"/>
+ </join>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetomany/Parent.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,50 @@
+//$Id: Parent.java 4378 2004-08-19 10:12:11Z oneovthafew $
+package mapping.onetomany;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+/**
+ * @author gavin
+ */
+public class Parent {
+ private Long id;
+ private String name;
+ private Collection children = new HashSet();
+ /**
+ * @return Returns the children.
+ */
+ public Collection getChildren() {
+ return children;
+ }
+ /**
+ * @param children The children to set.
+ */
+ public void setChildren(Collection children) {
+ this.children = children;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Address.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Address.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Address.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,57 @@
+//$Id: Address.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.formula;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Address implements Serializable {
+ private Person person;
+ private String type;
+ private String street;
+ private String state;
+ private String zip;
+
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+ public String getState() {
+ return state;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+ public String getStreet() {
+ return street;
+ }
+ public void setStreet(String street) {
+ this.street = street;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getZip() {
+ return zip;
+ }
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+ public boolean equals(Object that) {
+ if ( !(that instanceof Address) ) return false;
+ Address address = (Address) that;
+ return address.getType().equals(type) &&
+ address.getPerson().getName().equals( person.getName() );
+ }
+
+ public int hashCode() {
+ return person.getName().hashCode() + type.hashCode();
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.onetoone.formula">
+
+ <class name="Person">
+ <id name="name"/>
+ <one-to-one name="address" cascade="all" constrained="false">
+ <formula>name</formula>
+ <formula>'HOME'</formula>
+ </one-to-one>
+ <one-to-one name="mailingAddress" constrained="false">
+ <formula>name</formula>
+ <formula>'MAILING'</formula>
+ </one-to-one>
+ </class>
+
+ <class name="Address" batch-size="2"
+ check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
+ <composite-id>
+ <key-many-to-one name="person"
+ column="personName"/>
+ <key-property name="type"
+ column="addressType"/>
+ </composite-id>
+ <property name="street" type="text"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/formula/Person.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,42 @@
+//$Id: Person.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.formula;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Person implements Serializable {
+ private String name;
+ private Address address;
+ private Address mailingAddress;
+
+ public Address getAddress() {
+ return address;
+ }
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+ public Address getMailingAddress() {
+ return mailingAddress;
+ }
+ public void setMailingAddress(Address mailingAddress) {
+ this.mailingAddress = mailingAddress;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean equals(Object that) {
+ if ( !(that instanceof Person) ) return false;
+ Person person = (Person) that;
+ return person.getName().equals(name);
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Address.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Address.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Address.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,16 @@
+//$Id: Address.java 9914 2006-05-09 09:37:18Z max.andersen(a)jboss.com $
+package mapping.onetoone.joined;
+
+/**
+ * @author Gavin King
+ */
+public class Address {
+ public String entityName;
+ public String street;
+ public String state;
+ public String zip;
+
+ public String toString() {
+ return this.getClass() + ":" + street;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Entity.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,9 @@
+//$Id: Entity.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.joined;
+
+/**
+ * @author Gavin King
+ */
+public class Entity {
+ public String name;
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Org.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Org.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Org.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,9 @@
+//$Id: Org.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.joined;
+
+
+/**
+ * @author Gavin King
+ */
+public class Org extends Entity {
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping
+ package="mapping.onetoone.joined"
+ default-access="field">
+
+ <class name="Entity">
+ <id name="name"/>
+ <joined-subclass name="Person">
+ <key column="entityName"/>
+ <one-to-one name="address"
+ cascade="all"
+ constrained="true"/>
+ <one-to-one name="mailingAddress"
+ cascade="all"
+ entity-name="MailingAddress"/>
+ </joined-subclass>
+ <joined-subclass name="Org">
+ <key column="entityName"/>
+ </joined-subclass>
+ </class>
+
+ <class name="Address">
+ <id name="entityName"/>
+ <property name="street"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+ <class name="Address" entity-name="MailingAddress">
+ <id name="entityName"/>
+ <property name="street"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/joined/Person.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,10 @@
+//$Id: Person.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.joined;
+
+/**
+ * @author Gavin King
+ */
+public class Person extends Entity {
+ public Address address;
+ public Address mailingAddress;
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Customer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Customer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Customer.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,22 @@
+//$Id: Customer.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.link;
+
+/**
+ * @author Gavin King
+ */
+public class Customer {
+ private Long id;
+ private Person person;
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Employee.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,22 @@
+//$Id: Employee.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.link;
+
+/**
+ * @author Gavin King
+ */
+public class Employee {
+ private Long id;
+ private Person person;
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.hbm.xml 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+ <!--
+
+ Demonstrates the mapping of two subtyping one-to-one relationships
+ to association tables using <many-to-one> nested inside <join>.
+ Note that the <join> elements specify optional="true", and that
+ there is an inverse="true" side of both joins.
+
+ -->
+
+<hibernate-mapping package="mapping.onetoone.link">
+
+ <class name="Person">
+ <id name="name"/>
+ <property name="dob" type="date"/>
+ <join table="employeePerson"
+ inverse="true"
+ optional="true">
+ <key column="personId" unique="true"/>
+ <many-to-one name="employee"
+ column="employeeId"
+ cascade="all"
+ not-null="true"/>
+ </join>
+ <join table="customerPerson"
+ inverse="true"
+ optional="true">
+ <key column="personId" unique="true"/>
+ <many-to-one name="customer"
+ column="customerId"
+ cascade="all"
+ not-null="true"/>
+ </join>
+ </class>
+
+ <class name="Employee">
+ <id name="id" column="employeeId">
+ <generator class="native"/>
+ </id>
+ <join table="employeePerson"
+ optional="true">
+ <key column="employeeId"/>
+ <many-to-one name="person"
+ column="personId"
+ cascade="all"
+ not-null="true"
+ unique="true"/>
+ </join>
+ </class>
+
+ <class name="Customer">
+ <id name="id" column="customerId">
+ <generator class="native"/>
+ </id>
+ <join table="customerPerson" optional="true">
+ <key column="customerId"/>
+ <many-to-one name="person"
+ column="personId"
+ cascade="all"
+ not-null="true"
+ unique="true"/>
+ </join>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/link/Person.java 2007-07-26 13:44:25 UTC (rev 2677)
@@ -0,0 +1,38 @@
+//$Id: Person.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.onetoone.link;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+ private String name;
+ private Date dob;
+ private Employee employee;
+ private Customer customer;
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+ public Employee getEmployee() {
+ return employee;
+ }
+ public void setEmployee(Employee employee) {
+ this.employee = employee;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Date getDob() {
+ return dob;
+ }
+ public void setDob(Date dob) {
+ this.dob = dob;
+ }
+}
17 years, 5 months