Re: Middlegen EJB3 Sample released!

"Tuomas Kassila" <[email protected]> Wed, 4 Jan 2006 13:25:55 +0200
Newsgroups gmane.comp.java.ejb.middlegen.user
Message-ID <00f401c61121$a191fcd0$3401a8c0@tk>
This is a multi-part message in MIME format.

------=_NextPart_000_00F1_01C61132.64031B40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi all,

I changed two .vm files of the middlegen-ejb 3.0  so, that it is generating
and compiling after newer ejb 3.0 spec (jboss 4.03spi). These files comes as
insert files with this email. (they must updated into
middlegen-entitybean-plugin-2.2-dev.jar before a usage. There was needed to
change little also the build.xml file of the sample. This build.xml file is
not perfect, but it's here to show where are change points. Let me know if
there is errors etc. Hope these files helps to someone :).

Tuomas

----- Original Message ----- 
From: "Eivind Waaler" <[email protected]>
To: <[email protected]>;
<[email protected]>;
<[email protected]>
Sent: Sunday, November 28, 2004 12:51 AM
Subject: [Middlegen-user] Middlegen EJB3 Sample released!


> We've released a small sample of the new EJB3 plugin, based on the EJB3
> Preview of JBoss4. Download and try from this page:
>
>
http://sourceforge.net/project/showfiles.php?group_id=36044&package_id=136741&release_id=285881
>
> It contains a small hsqldb (the standard Middelgen sample - "airline"),
> but should teoretically work with all databases supported by other
> Middlegen plugins.
>
> To run the sample:
>
> 1) Set JAVA_HOME to a JDK 1.5 release.
>
> 2) Set JBOSS_HOME to point to the JBoss4 release with the EJB 3.0 preview.
>
> 3) Run 'ant' to generate Entity beans and deploy with sample code.
>
> 4) Run 'ant run' to run the client sample.
>
> Let us know if there are any problems.
>
> .eivind
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> middlegen-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
>

------=_NextPart_000_00F1_01C61132.64031B40
Content-Type: application/octet-stream;
	name="entity-cmp-30-pk.vm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="entity-cmp-30-pk.vm"

   /**
    * Primary key class for ${table.sqlName}.
    *
    * @author <a =
href=3D"http://boss.bekk.no/boss/middlegen/">Middlegen</a>.
    */
   public class ${table.destinationClassName}PK implements Serializable =
{
#foreach ($column in $table.primaryKeyColumns)

      /** PK field. */
      private ${column.javaType} ${column.variableName};

      /**
       * Get the ${column.variableName}.
       *
       * @return The ${column.variableName}.
       */
      @javax.persistence.Column(name =3D "${column.sqlName}")
      public ${column.javaType} ${column.getterName}() {
         return ${column.variableName};
      }

      /**
       * Set the ${column.variableName}.
       *
       * @param ${column.variableName} The ${column.variableName}.
       */
      public void ${column.setterName}(${column.javaType} =
${column.variableName}) {
         this.${column.variableName} =3D ${column.variableName};
      }
#end
   }

------=_NextPart_000_00F1_01C61132.64031B40
Content-Type: application/octet-stream;
	name="entity-cmp-30.vm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="entity-cmp-30.vm"

package $table.package;

import java.io.Serializable;

/**
 * CMP 3.0 class for ${table.sqlName}.
 *
 * @author <a =
href=3D"http://boss.bekk.no/boss/middlegen/">Middlegen</a>.
 */
@javax.persistence.Entity
@javax.persistence.Table(name =3D "${table.sqlName}")
public class $table.destinationClassName implements Serializable {
## PK
#if ($table.primaryKeyColumns.size() =3D=3D 0)
   // WARNING! NO PRIMARY KEY FOUND, ENTITY BEANS REQUIRE A PRIMARY KEY.
#elseif ($table.compositeKey)

   /** Primary key. */
   private ${table.destinationClassName}PK primaryKey;

   /** Standard constructor, initializing the primary key. */
   public ${table.destinationClassName}() {
		primaryKey =3D new ${table.destinationClassName}PK();
	}

   /**
    * Get the primary key.
    *
    * @return The primary key.
    */
   @javax.persistence.Id(generate =3D =
javax.persistence.GeneratorType.NONE)
   public ${table.destinationClassName}PK getPrimaryKey() {
      return primaryKey;
   }

   /**
    * Set the primary key.
    *
    * @param primaryKey The primary key.
    */
   public void setPrimaryKey(${table.destinationClassName}PK primaryKey) =
{
      this.primaryKey =3D primaryKey;
   }
#else
#set ($column =3D $table.pkColumn)

   /** Primary key. */
   private ${column.javaType} ${column.variableName};

   /**
    * Get the primary key.
    *
    * @return The primary key.
    */
   @javax.persistence.Id(generate =3D =
javax.persistence.GeneratorType.AUTO)
   @javax.persistence.Column(name =3D "${column.sqlName}") // , =
primaryKey =3D true
   public ${column.javaType} ${column.getterName}() {
      return ${column.variableName};
   }

   /**
    * Set the primary key.
    *
    * @param ${column.variableName} The primary key.
    */
   public void ${column.setterName}(${column.javaType} =
${column.variableName}) {
      this.${column.variableName} =3D ${column.variableName};
   }
#end
## END PK
## FIELDS
#foreach ($column in $table.notKeyColumns)

   /** Regular field. */
   private ${column.javaType} ${column.variableName};

   /**
    * Get the ${column.variableName}.
    *
    * @return The ${column.variableName}.
    */
   @javax.persistence.Column(name =3D "${column.sqlName}")
   public ${column.javaType} ${column.getterName}() {
      return ${column.variableName};
   }

   /**
    * Set the ${column.variableName}.
    *
    * @param ${column.variableName} The ${column.variableName}.
    */
   public void ${column.setterName}(${column.javaType} =
${column.variableName}) {
      this.${column.variableName} =3D ${column.variableName};
   }
#end
## END FIELDS
## ASSOCIATIONS
#foreach ($relationshipRole in $table.relationshipRoles)
#if ($relationshipRole.enabled)
#set ($bidirectional =3D $relationshipRole.relation.bidirectional)
#set ($target =3D $relationshipRole.getTarget($plugin))
#set ($relationName =3D "${relationshipRole.relation.getName($plugin)}")
## COMMON FOR ALL ASSOCIATIONS

   /** Association. */
   private $table.getClassName($relationshipRole) =
$table.getVariableName($relationshipRole);

   /**
    * Get the $table.getVariableName($relationshipRole).
    *
    * @return The $table.getVariableName($relationshipRole).
    */
## ONE-TO-ONE
#if ($table.isOne2One($relationshipRole))
   @javax.persistence.OneToOne(cascade =3D =
{javax.persistence.CascadeType.ALL})
#set ( $test =3D [$relationshipRole.columnMaps] )=20
#if ($test.size() =3D=3D 1)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#else
   @javax.persistence.JoinColumns({
#foreach ($columnMap in $relationshipRole.columnMaps)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#if (($test.size() !=3D $velocityCount))
,
#end=20
#end=20

#end
## MANY-TO-MANY
#elseif ($table.isMany2Many($relationshipRole))
   @javax.persistence.ManyToMany(cascade =3D =
{javax.persistence.CascadeType.CREATE, =
javax.persistence.CascadeType.MERGE}, fetch =3D =
javax.persistence.FetchType.EAGER)
   @javax.persistence.AssociationTable(table =3D =
@javax.persistence.Table(name =3D =
"${relationshipRole.relation.joinTable.sqlName}"),
#foreach ($columnMap in $relationshipRole.columnMaps)
                     joinColumns =3D {@javax.persistence.JoinColumn(name =
=3D "${columnMap.foreignKey}")},
#end
#foreach ($columnMap in $relationshipRole.targetRole.columnMaps)
                     inverseJoinColumns =3D =
{@javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")})
#end
## ONE-TO-MANY
#elseif ($table.isOne2Many($relationshipRole))
   @javax.persistence.OneToMany(cascade =3D =
javax.persistence.CascadeType.ALL, fetch =3D =
javax.persistence.FetchType.EAGER)
#set ( $test =3D [$relationshipRole.columnMaps] )=20
#if ($test.size() =3D=3D 1)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#else
   @javax.persistence.JoinColumns({
#foreach ($columnMap in $relationshipRole.columnMaps)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#if (($test.size() !=3D $velocityCount))
,
#end=20
#end=20
                                  })
#end
## MANY-TO-ONE
#else
   @javax.persistence.ManyToOne
#set ( $test =3D [$relationshipRole.columnMaps] )=20
#if ($test.size() =3D=3D 1)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#else
   @javax.persistence.JoinColumns({
#foreach ($columnMap in $relationshipRole.columnMaps)
   @javax.persistence.JoinColumn(name =3D "${columnMap.foreignKey}")
#if (($test.size() !=3D $velocityCount))
,
#end=20
#end=20

#end
#end
## COMMON FOR ALL ASSOCIATIONS
   public $table.getClassName($relationshipRole) =
$table.getGetterName($relationshipRole)() {
      return $table.getVariableName($relationshipRole);
   }

   /**
    * Set the $table.getVariableName($relationshipRole).
    *
    * @param $table.getVariableName($relationshipRole) The =
$table.getVariableName($relationshipRole).
    */
   public void =
$table.getSetterName($relationshipRole)($table.getClassName($relationship=
Role) $table.getVariableName($relationshipRole)) {
      this.$table.getVariableName($relationshipRole) =3D =
$table.getVariableName($relationshipRole);
   }
#end
#end
## END ASSOCIATIONS
#if ($table.compositeKey)

#parse ("middlegen/plugins/entitybean/entity-cmp-30-pk.vm")
#end
}

------=_NextPart_000_00F1_01C61132.64031B40--



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click