[jboss-cvs] JBossAS SVN: r83140 - in projects/ejb3/trunk/docs/tutorial: tableperinheritance and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 21 02:42:09 EST 2009


Author: jaikiran
Date: 2009-01-21 02:42:09 -0500 (Wed, 21 Jan 2009)
New Revision: 83140

Added:
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/persistence.xml
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/build.xml
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/jndi.properties
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/log4j.xml
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/pom.xml
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Cat.java
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Dog.java
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Pet.java
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAO.java
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAOBean.java
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/
   projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/Client.java
Log:
EJBTHREE-1657 TablePerInheritance tutorial - The client for the tutorial has been disabled since it fails against HSQLDB. The tutorial guide has been updated with instructions to the user to use a different DB server

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/persistence.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/persistence.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/persistence.xml	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
+   
+   <persistence-unit name="tempdb">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/META-INF/persistence.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/build.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/build.xml	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   <property environment="env"/>
+   <property name="src.dir" value="${basedir}/src"/>
+   <property name="jboss.home" value="${env.JBOSS_HOME}"/>
+   <property name="jboss.server.config" value="default"/>
+   <property name="build.dir" value="${basedir}/build"/>
+   <property name="build.classes.dir" value="${build.dir}/classes"/>
+   <property name="build.artifact" value="jboss-ejb3-tutorial-entity-tableperinheritance.jar"/>
+
+   <!-- Build classpath -->
+   <path id="classpath">
+      <!-- So that we can get jndi.properties for InitialContext -->
+      <pathelement location="${basedir}"/>
+		<!-- jbossall-client.jar for JBoss related classes -->
+		<fileset dir="${jboss.home}/client">
+ 			<include name="**/jbossall-client.jar"/>
+		</fileset>
+		<!-- Hibernate core classes -->
+		<fileset dir="${jboss.home}/common/lib">
+			<include name="hibernate-core.jar"/>
+		</fileset>
+		<!-- javax.peristence.* -->
+		<fileset dir="${jboss.home}/common/lib">
+			<include name="ejb3-persistence.jar"/>
+		</fileset>
+      <pathelement location="${build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${build.classes.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+      <javac srcdir="${src.dir}"
+         destdir="${build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="build/${build.artifact}">
+         <fileset dir="${build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+         <fileset dir=".">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+      <copy file="build/${build.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+	<!--TODO: Because of a bug in HSQL, the tutorial does not work. So let's just deploy/undeploy
+  	this tutorial and not run the client, till it is fixed 
+   <target name="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.tableperinheritance.client.Client" fork="yes" dir=".">
+         <classpath refid="classpath"/>
+      </java>
+   </target> -->
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean.db">
+      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.artifact}"/>
+   </target>
+
+
+</project>
+


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/build.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/jndi.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/jndi.properties	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/jndi.properties
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/log4j.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/log4j.xml	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 32809 2005-06-24 04:49:29Z bill $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+   
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Messagen -->
+         <!--
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+         -->
+         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
+      </layout>
+</appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/log4j.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/pom.xml	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  
+
+  
+   
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-tutorial-common</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../common/</relativePath>
+  </parent>
+
+  <properties>
+  	<!--  TODO: Because of a bug in HSQL, the tutorial does not work. So let's just deploy/undeploy
+  	this tutorial and not run the client, till it is fixed -->
+  	<jboss.ejb3.tutorial.client.skip>true</jboss.ejb3.tutorial.client.skip>
+    <!--  <ejb3.tutorial.client>org.jboss.tutorial.tableperinheritance.Client.Client</ejb3.tutorial.client> -->
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-entity-tableperinheritance</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Table-per-Inheritance in EJB3 Entities</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial demonstrating Table-per-Inheritance in EJB3 Entities
+  </description>
+  
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Cat.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Cat.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Cat.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.bean;
+
+import javax.persistence.Entity;
+
+ at Entity
+public class Cat extends Pet
+{
+   int lives;
+
+   public int getLives()
+   {
+      return lives;
+   }
+
+   public void setLives(int lives)
+   {
+      this.lives = lives;
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Cat.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Dog.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Dog.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Dog.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.bean;
+
+import javax.persistence.Entity;
+
+ at Entity
+public class Dog extends Pet
+{
+   private int numBones;
+
+   public int getNumBones()
+   {
+      return numBones;
+   }
+
+   public void setNumBones(int numBones)
+   {
+      this.numBones = numBones;
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Dog.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Pet.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Pet.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Pet.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.bean;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+ at Entity
+ at Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class Pet implements java.io.Serializable
+{
+   private int id;
+   private String name;
+   private double weight;
+
+   @Id
+   @GeneratedValue(strategy=GenerationType.TABLE)
+   public int getId()
+   {
+      return id;
+   }
+
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public double getWeight()
+   {
+      return weight;
+   }
+
+   public void setWeight(double weight)
+   {
+      this.weight = weight;
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/Pet.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAO.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAO.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAO.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.bean;
+
+import java.util.List;
+
+public interface PetDAO
+{
+   void createDog(String name, double weight, int bones);
+
+   void createCat(String name, double weight, int lives);
+
+   List findByWeight(double weight);
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAO.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAOBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAOBean.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAOBean.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.bean;
+
+import java.util.List;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContext;
+
+ at Stateless
+ at Remote(PetDAO.class)
+public class PetDAOBean implements PetDAO
+{
+   @PersistenceContext
+   private EntityManager manager;
+
+   public void createDog(String name, double weight, int bones)
+   {
+      Dog dog = new Dog();
+      dog.setName(name);
+      dog.setWeight(weight);
+      dog.setNumBones(bones);
+      manager.persist(dog);
+   }
+
+   public void createCat(String name, double weight, int lives)
+   {
+      Cat cat = new Cat();
+      cat.setName(name);
+      cat.setWeight(weight);
+      cat.setLives(lives);
+      manager.persist(cat);
+   }
+
+   public List findByWeight(double weight)
+   {
+      return manager.createQuery("from Pet p where p.weight < :weight").setParameter("weight", weight).getResultList();
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/bean/PetDAOBean.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/Client.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/Client.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/Client.java	2009-01-21 07:42:09 UTC (rev 83140)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.tableperinheritance.client;
+
+
+import org.jboss.tutorial.tableperinheritance.bean.Pet;
+import org.jboss.tutorial.tableperinheritance.bean.PetDAO;
+
+import javax.naming.InitialContext;
+
+import java.util.List;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+public class Client
+{
+   public static void main(String[] args) throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      PetDAO dao = (PetDAO) ctx.lookup("PetDAOBean/remote");
+
+      dao.createCat("Toonses", 15.0, 9);
+      dao.createCat("Sox", 10.0, 5);
+      dao.createDog("Winnie", 70.0, 5);
+      dao.createDog("Junior", 11.0, 1);
+
+      List l = dao.findByWeight(14.0);
+      for (Object o : l)
+      {
+         System.out.println(((Pet) o).getName());
+      }
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/tableperinheritance/src/org/jboss/tutorial/tableperinheritance/client/Client.java
___________________________________________________________________
Name: svn:executable
   + *




More information about the jboss-cvs-commits mailing list