RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2004-01-06 Thread Alexey Loubyansky
The spec does not disallow it and there is a chance that it will be
supported in future releases.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Hanson, Matthew
> Sent: Tuesday, January 06, 2004 3:12 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> thanks, alexey--
> 
> i have decided to take an alternate approach to reference 
> data...  i do not think that creating the relationship type 
> that i would like is supported, because it would entail 
> referencing a non-primary-key field...  is this type of 
> relationship not supported due to the j2ee spec, or will it 
> potentially be supported in future releases?



---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2004-01-06 Thread Hanson, Matthew
thanks, alexey--

i have decided to take an alternate approach to reference data...  i do not
think that creating the relationship type that i would like is supported,
because it would entail referencing a non-primary-key field...  is this type
of relationship not supported due to the j2ee spec, or will it potentially
be supported in future releases?

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 4:16 AM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship
Prob lem


Hello,

comments below.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Hanson, Matthew
> Sent: Monday, January 05, 2004 4:41 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> Hi,
> 
> Hadn't gotten a response, so I thought I would try again...  
> Really looking to get this type of 1:1 relationship pinned 
> down, as it would complete a bunch of the schema stuff of the app...
> 
> Thanks!
> Matt Hanson
> 
> -Original Message-
> From: Hanson, Matthew [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 7:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> 
> Is id (from ) a field belonging to B or A?

A

  Is 
> the a_fk (from
> ) column from B or A?

This is a foreign key column referencing A.id in the table entity B is
mapped to.

>  What if the columns and 
> fields from B bean are totally different from A (i.e., 
> B.weird_column_name with
> B.getWeirdColumnName() maps to A.a_primary_key and 
> a.getMyKey())?  What would the resulting jbosscmp-jdbc.xml look like?

Just specify the foreign key column name as it is shown in the example
(a_fk). This column will reference the primary key column in the table A
is mapped to. Referencing other than primary key unique column in A's
table is not supported.

> 
> I think I have been able to set up the type of relationship 
> you mention below.  However, it only seems to work if the 
> primary key from B is found in A with the same column name 
> for both tables.  This isn't exactly what I am hoping to do.
> 
> In my case, the primary key from B is simply not relevent to 
> A, and B contains a non-primary-key field linking it to A.

If it references A's primary key, it is a mapping issue. It should work.

> 
> Does this now make sense?
> 
> -Original Message-
> From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 1:56 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Problem
> 
> 
>  Here is an example for 1:1 unidirectional relationship from B to A:
> In B:
>/**
> * @ejb.relation
> *name="A-B"
> *role-name="B-has-A"
> *target-ejb="A"
> *target-role-name="A-belongsto-B"
> *target-multiple="false"
> * @jboss.relation
> *related-pk-field="id"
> *fk-column="a_fk"
> * @ejb.interface-method
> */
>public abstract ALocal getA();
>/**
>* @ejb.interface-method
>*/
>public abstract void setA(ALocal value); 
> 
> Resulting DDs:
> 
> ejb-jar.xml:
>   
>  A-B
> 
>  
> 
> B-has-A
> One
> 
>B
> 
> 
>a
> 
>  
> 
>  
>  
> A-belongsto-B
> One
> 
>A
> 
>  
> 
>   
> 
> jbosscmp-jdbc.xml:
> 
>   A-B
> 
>   
>   
> B-has-A
> 
> 
>   
>   
>  
> A-belongsto-B
>   
>  
>id
>a_fk
>  
>   
> 
>   
> 
> 
> 
> 
> 
> ---
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> ---
> This SF.net ema

RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2004-01-06 Thread Alexey Loubyansky
Hello,

comments below.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Hanson, Matthew
> Sent: Monday, January 05, 2004 4:41 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> Hi,
> 
> Hadn't gotten a response, so I thought I would try again...  
> Really looking to get this type of 1:1 relationship pinned 
> down, as it would complete a bunch of the schema stuff of the app...
> 
> Thanks!
> Matt Hanson
> 
> -Original Message-
> From: Hanson, Matthew [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 7:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> 
> Is id (from ) a field belonging to B or A?

A

  Is 
> the a_fk (from
> ) column from B or A?

This is a foreign key column referencing A.id in the table entity B is
mapped to.

>  What if the columns and 
> fields from B bean are totally different from A (i.e., 
> B.weird_column_name with
> B.getWeirdColumnName() maps to A.a_primary_key and 
> a.getMyKey())?  What would the resulting jbosscmp-jdbc.xml look like?

Just specify the foreign key column name as it is shown in the example
(a_fk). This column will reference the primary key column in the table A
is mapped to. Referencing other than primary key unique column in A's
table is not supported.

> 
> I think I have been able to set up the type of relationship 
> you mention below.  However, it only seems to work if the 
> primary key from B is found in A with the same column name 
> for both tables.  This isn't exactly what I am hoping to do.
> 
> In my case, the primary key from B is simply not relevent to 
> A, and B contains a non-primary-key field linking it to A.

If it references A's primary key, it is a mapping issue. It should work.

> 
> Does this now make sense?
> 
> -Original Message-
> From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 1:56 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Problem
> 
> 
>  Here is an example for 1:1 unidirectional relationship from B to A:
> In B:
>/**
> * @ejb.relation
> *name="A-B"
> *role-name="B-has-A"
> *target-ejb="A"
> *target-role-name="A-belongsto-B"
> *target-multiple="false"
> * @jboss.relation
> *related-pk-field="id"
> *fk-column="a_fk"
> * @ejb.interface-method
> */
>public abstract ALocal getA();
>/**
>* @ejb.interface-method
>*/
>public abstract void setA(ALocal value); 
> 
> Resulting DDs:
> 
> ejb-jar.xml:
>   
>  A-B
> 
>  
> 
> B-has-A
> One
> 
>B
> 
> 
>a
> 
>  
> 
>  
>  
> A-belongsto-B
> One
> 
>A
> 
>  
> 
>   
> 
> jbosscmp-jdbc.xml:
> 
>   A-B
> 
>   
>   
> B-has-A
> 
> 
>   
>   
>  
> A-belongsto-B
>   
>  
>id
>a_fk
>  
>   
> 
>   
> 
> 
> 
> 
> 
> ---
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> ---
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> ---
> This SF.net email is sponsored by: IBM L

RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2004-01-05 Thread Hanson, Matthew
Hi,

Hadn't gotten a response, so I thought I would try again...  Really looking
to get this type of 1:1 relationship pinned down, as it would complete a
bunch of the schema stuff of the app...

Thanks!
Matt Hanson

-Original Message-
From: Hanson, Matthew [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 7:17 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship
Prob lem


Is id (from ) a field belonging to B or A?  Is the a_fk (from
) column from B or A?  What if the columns and fields from B
bean are totally different from A (i.e., B.weird_column_name with
B.getWeirdColumnName() maps to A.a_primary_key and a.getMyKey())?  What
would the resulting jbosscmp-jdbc.xml look like?

I think I have been able to set up the type of relationship you mention
below.  However, it only seems to work if the primary key from B is found in
A with the same column name for both tables.  This isn't exactly what I am
hoping to do.

In my case, the primary key from B is simply not relevent to A, and B
contains a non-primary-key field linking it to A.

Does this now make sense?

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 1:56 AM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship
Problem


 Here is an example for 1:1 unidirectional relationship from B to A:
In B:
   /**
* @ejb.relation
*name="A-B"
*role-name="B-has-A"
*target-ejb="A"
*target-role-name="A-belongsto-B"
*target-multiple="false"
* @jboss.relation
*related-pk-field="id"
*fk-column="a_fk"
* @ejb.interface-method
*/
   public abstract ALocal getA();
   /**
   * @ejb.interface-method
   */
   public abstract void setA(ALocal value); 

Resulting DDs:

ejb-jar.xml:
  
 A-B

 
B-has-A
One

   B


   a

 

 
 
A-belongsto-B
One

   A

 

  

jbosscmp-jdbc.xml:

  A-B

  
  B-has-A
  

  
  
 
A-belongsto-B
  
 
   id
   a_fk
 
  

  





---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2003-12-30 Thread Hanson, Matthew
Is id (from ) a field belonging to B or A?  Is the a_fk (from
) column from B or A?  What if the columns and fields from B
bean are totally different from A (i.e., B.weird_column_name with
B.getWeirdColumnName() maps to A.a_primary_key and a.getMyKey())?  What
would the resulting jbosscmp-jdbc.xml look like?

I think I have been able to set up the type of relationship you mention
below.  However, it only seems to work if the primary key from B is found in
A with the same column name for both tables.  This isn't exactly what I am
hoping to do.

In my case, the primary key from B is simply not relevent to A, and B
contains a non-primary-key field linking it to A.

Does this now make sense?

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 1:56 AM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship
Problem


 Here is an example for 1:1 unidirectional relationship from B to A:
In B:
   /**
* @ejb.relation
*name="A-B"
*role-name="B-has-A"
*target-ejb="A"
*target-role-name="A-belongsto-B"
*target-multiple="false"
* @jboss.relation
*related-pk-field="id"
*fk-column="a_fk"
* @ejb.interface-method
*/
   public abstract ALocal getA();
   /**
   * @ejb.interface-method
   */
   public abstract void setA(ALocal value); 

Resulting DDs:

ejb-jar.xml:
  
 A-B

 
B-has-A
One

   B


   a

 

 
 
A-belongsto-B
One

   A

 

  

jbosscmp-jdbc.xml:

  A-B

  
  B-has-A
  

  
  
 
A-belongsto-B
  
 
   id
   a_fk
 
  

  





---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2003-12-29 Thread Hanson, Matthew
Hi,

I'm confused...  I cannot remove the target-relation tag, because it is
needed to generate the jbosscmp-jdbc.xml mappings for the relationshipp I'm
trying to create.

What I am trying to do is fetch data from tableB based on a key found in
tableA, in a 1:1 relationship, where tableB is reference data and has no
knowledge of tableA and used as a lookup so that tableA doesn't need to
store a bunch of duplicate data for each entry.

Here is an example of something I want to do:

1) Beer Recipe table
Recipe_Grain_Id - primary key
Grain_Type - integer mapping to the grain table mapping to grain.grain_id

2) Grain table
Grain_Id - primary key
Grain_name - data
Grain data 1
Grain data 2
Etc.

How should this relationship be set up?

I initially thought of making it a 1:1 unidirectional, where the recipe
table can return the local bean object of the grain itself.  However, I
don't seem to be able to get the jbosscmp-jdbc.xml relationship element
setup for jboss to understand this.

Is this just something that cannot be done in this context?  If it can be
done, how would the relationship look in jbosscmp-jdbc.xml (key-field,
column-name, field-name)?  Does this have anything to do with primary key
fields?  The code in JDBCRelationshipRoleMetaData.java, where the exceptions
have been thrown, seems to look like the grain_type column from table #1
must be a primary key field.

I'm lost...  Can someone set me straight on if this relationship should
work???  I would really need to know exactly how the relationship should
look in jbosscmp-jdbc.xml.

Thanks, in advance, for the help...

Regards,
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 1:27 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship
Problem


Because you mapped the foreign key to the primary key field with this:
*   @jboss.target-relation fk-column="recipe_grain_id"
*   related-pk-field="recipeGrainId" 

Just removed it.




---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] 1:1 Unidirectional (Aggregate) Relationship Prob lem

2003-12-23 Thread Hanson, Matthew
I am using jboss 3.2.2.  Here are the class defs for the bean and a test
client that I have been using.  Please let me know if you need anything
else...

RecipeGrainBean.java

package homebrew.ejb.entity;

// homebrew.ejb.interfaces imports
import homebrew.ejb.entity.vo.RecipeGrainBeanValue;
import homebrew.ejb.entity.reference.interfaces.RefRecipeGrainBeanLocal;

// javax.ejb imports
import javax.ejb.CreateException;
// org.apache.log4j imports
import org.apache.log4j.Logger;
import java.sql.Timestamp;
import homebrew.ejb.util.db.GetTimestamp;
import java.rmi.RemoteException;

/**
*
*   Class representing recipe grain information stored in the database.
*   Class maintains grain information such as grain type (grain
reference id),
*   the recipe to which the grain belongs, and the total weight in
*   pounds being added to the recipe.
*
*   Methods exists to get and set the grain value object.
*
*   @author Matthew Hanson
*
*   @ejb.bean name="RecipeGrainBean"
*   display-name="Recipe grain"
*   local-jndi-name="homebrew/ejb/entity/RecipeGrainBean"
*   view-type="local"
*   type="CMP"
*   schema="recipe_grain"
*
*   @ejb.home generate="local"
*
*   @ejb.interface generate="local"
*
*   @ejb.pk extends="java.lang.Object"
*
*   @ejb.transaction type="Required"
*
*   @ejb.value-object match="*"
*
*   @jboss.persistence
*   datasource="java:/DefaultDS"
*   datasource-mapping="Hypersonic SQL"
*   table-name="recipe_grain"
*
*   @jboss.entity-command
*   name="hsqldb-fetch-key"
*
*   @ejb.persistence table-name="recipe_grain"
*
*   @ejb.facade
*
*   @ejb.util
*   generate="physical"
*/
public abstract class RecipeGrainBean extends DefaultEntityBean {

private static Logger logger =
Logger.getLogger(RecipeGrainBean.class);

/**
*   @ejb.pk-field
*   @ejb.persistent-field
*   @ejb.interface-method
*
*   @ejb.persistence
*
*   @jboss.column-name name="recipe_grain_id"
*
*   @jboss.auto-increment
*
*   @return The primary key of the recipe grain
*
*   Get the primary key of the recipe grain
*/
public abstract Integer getRecipeGrainId();
/**
*   @ejb.interface-method view="local"
*   @ejb.persistent-field
*
*   @jboss.column-name name="recipe_grain_id"
*   @jboss.persistence auto-increment="true"
*   @jboss.auto-increment
*
*   @param  theRecipeGrainIdThe primary key to be
assigned to the recipe grain
*
*   Set the primary key of the recipe grain
*/
public abstract void setRecipeGrainId(Integer theRecipeGrainId);

/**
*   @ejb.interface-method view="local"
*   @ejb.persistence
*   @ejb.interface-method
*
*   @jboss.column-name name="recipe_id"
*
*   @return The primary key of the recipe to which the grain
belongs
*
*   Get the primary key of the recipe to which the grain belongs
*/
/**
*   @ejb.interface-method view="local"
*   @ejb.persistent-field
*
*   @jboss.column-name name="created_timestamp"
*
*   @param  theCreatedTimeStamp The create timestamp value
to be assigned
*
*   Set the created timestamp
*/
public abstract void setCreatedTimestamp(Timestamp
theCreatedTimeStamp);
/**
*   @ejb.interface-method view="local"
*   @ejb.persistent-field
*
*   @jboss.column-name name="created_timestamp"
*
*   @return The timestamp for when the account was created
*
*   Get the created timestamp
*/
public abstract Timestamp getCreatedTimestamp();
/**
*   @ejb.interface-method view="local"
*   @ejb.persistent-field
*
*   @jboss.column-name name="modified_timestamp"
*
*   @return The timestamp for when the account was modified
*
*   Get the modified timestamp
*/
public abstract Timestamp getModifiedTimestamp();
/**
*   @ejb.interface-method view="local"
*   @ejb.persistent-field
*
*   @jboss.column-name name="modified_timestamp"
*
*   @param  theModifiedTimeStampThe modified timestamp value
to be assigned
*
*   Set the modified timestamp
*/
public abstract void setModifiedTimestamp(Timestamp
theModifiedTimeStamp);
public abstract Integer getRecipeId();
/**