You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Patrick Scheuerer <pa...@hispeed.ch> on 2003/12/10 08:15:55 UTC

Newbie needs help

Hello everybody,

I just got started with OJB and i'm experiencing some problems. Here's the
scenario that i'm trying to get to work:

A DOCUMENT belongs to 1..n CATEGORY.
A DOCUMENT is relevant to 0..n PRODUCT_MODELs.
A DOCUMENT is written by 1..1 AUTHOR.
D DOCUMENT is described by 1..n KEYWORDs.

My first question is: since there are many-to-many relatioships between
DOCUMENT and CATEGORY and DOCUMENT and KEYWORDS there are two join tables
called DOCUMENT_CATEGORY and DOCUMENTS_KEYWORD. How does one handle join
tables needed by many-to-many in OJB?

All the data retrieved from the database (MySQL) should be wrapped in
ValueObject Classes.

Following is the repository_user.xml file that I'm using so far. Every time
I'm trying to save object to the datastore or try to retrieve them I get a
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException with the
following message: java.util.ArrayList not found in OJB Repository.

Somebody suggested yesterday to use a List instead of a Vector (I tried
Vectors first) but the result is the same.

I tips, hints, suggestions would be highly appreciated. TIA.

Patrick

<-- start of repository_user.xml -->
<class-descriptor class="ch.ctc.support.member.MemberVO" 
			table="member"> 

	<field-descriptor id="1" 
					  name="memberId" 
					  column="member_id" 
					  jdbc-type="BIGINT" 
					  primarykey="true" 
					  autoincrement="true"
					  access="anonymous"/> 
	
	<field-descriptor id="2" 
					  name="firstName" 
					  column="first_name" 
					  jdbc-type="VARCHAR"/> 
	
	<field-descriptor id="3" 
					  name="lastName" 
					  column="last_name" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="4" 
					  name="userName" 
					  column="user_name" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="5" 
					  name="password" 
					  column="password" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="6" 
					  name="email" 
					  column="email" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="7" 
					  name="companyId" 
					  column="company_id" 
					  jdbc-type="BIGINT"/>
					  
	<reference-descriptor name="category" 
	
class-ref="ch.ctc.suppport.CategoryVO" 
						  auto-retrieve="true">
		<foreignkey field-id-ref="9"/>
	</reference-descriptor>
</class-descriptor>

<class-descriptor class="ch.ctc.support.document.DocumentVO" 
			table="document"> 

	<field-descriptor id="1" 
					  name="documentId" 
					  column="document_id" 
					  jdbc-type="BIGINT" 
					  primarykey="true" 
					  autoincrement="true"
					  access="anonymous"/>

	
	<field-descriptor id="2" 
					  name="documentName" 
					  column="document_name" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="3" 
					  name="documentDescription" 
					  column="document_description" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="4" 
					  name="documentVersion" 
					  column="document_version" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="5" 
					  name="documentAbstract" 
					  column="document_abstract" 
					  jdbc-type="LONGVARBINARY"/>
					   
	<field-descriptor id="6" 
					  name="creationDate" 
					  column="creation_date" 
					  jdbc-type="DATE"/>
					  
	<field-descriptor id="7" 
					  name="palModel" 
					  column="pal_model_id" 
					  jdbc-type="BIGINT"/>
					  
	<field-descriptor id="8" 
					  name="keywords" 
					  column="keyword_id" 
					  jdbc-type="BIGINT"/>
					  
	<field-descriptor id="9" 
					  name="category" 
					  column="category_id" 
					  jdbc-type="BIGINT"/>
					  
	<field-descriptor id="10" name="documentAuthor" 
					  column="member_id" 
					  jdbc-type="BIGINT"/>
	
	<collection-descriptor name ="palModel" 
	
element-class-ref="ch.ctc.support.category.PalModelVO" 
						   auto-retrieve="true" 
						   auto-update="true" 
	
indirection-table="pal_relevancy"> 
		<fk-pointing-to-this-class column="pal_model_id"/>
		<fk-pointing-to-this-class column="document_id"/>
	</collection-descriptor>
	
	<collection-descriptor name ="keywords"
	
element-class-ref="ch.ctc.support.category.KeywordVO" 
						   auto-retrieve="true" 
						   auto-update="true" 
	
indirection-table="document_keyword"> 
		<fk-pointing-to-this-class column="keyword_id"/>
		<fk-pointing-to-this-class column="document_id"/>
	</collection-descriptor>
	
	<reference-descriptor name="category" 
	
class-ref="ch.ctc.suppport.CategoryVO" 
						  auto-retrieve="true">
		<foreignkey field-id-ref="9"/>
	</reference-descriptor>
	
	<reference-descriptor name="doucmentAuthor" 
	
class-ref="ch.ctc.suppport.MemberVO" 
						  auto-retrieve="true">
		<foreignkey field-id-ref="10"/>
	</reference-descriptor>
</class-descriptor>

<class-descriptor class="ch.ctc.support.category.CategoryVO" 
			table="category"> 
	
	<field-descriptor id="1" 
					  name="categoryId" 
					  column="category_id" 
					  jdbc-type="BIGINT" 
					  primarykey="true" 
					  autoincrement="true"
					  access="anonymous"/> 
					   
	<field-descriptor id="2" 
					  name="categoryName" 
					  column="category_name" 
					  jdbc-type="VARCHAR"/> 
					  
	<field-descriptor id="3" 
					  name="categoryDescription" 
					  column="category_description" 
					  jdbc-type="VARCHAR"/> 
</class-descriptor>
	
<class-descriptor class="ch.ctc.support.category.PALModelVO" 
			table="pal_model">	
	
	<field-descriptor id="1" 
					  name="palModelId" 
					  column="pal_model_id" 
					  jdbc-type="BIGINT" 
					  primarykey="true" 
					  autoincrement="true"
					  access="anonymous"/> 
					  
	<field-descriptor id="2" 
					  name="palModelName" 
					  column="pal_model_name" 
					  jdbc-type="VARCHAR"/>
					  
	<field-descriptor id="3" 
					  name="palModelDescription" 
					  column="pal_model_description" 
					  jdbc-type="VARCHAR"/>
</class-descriptor>
	
<class-descriptor class="ch.ctc.support.category.CompanyVO" 
			table="company">
	
	<field-descriptor id="1" 
					  name="companyId"
					  column="company_id" 
					  jdbc-type="BIGINT" 
					  primarykey="true" 
					  autoincrement="true"/> 
					  
	<field-descriptor id="2" 
					  name="companyName" 
					  column="company_name" 
					  jdbc-type="VARCHAR"/>
</class-descriptor>
<-- end of repository_user.xml -->



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org