Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-14 Thread Sylvain Juge
Hi,

Thank for your help, but I think I solved my problem.
I don't know what I was doing wrong, but simply by rewriting by hand the 
Apartment Class, I solved the problem.
Now I works really great, despite sometimes Eclipse seems to go a little crazy, 
so I think I also need to update it (ver 3.0.1).

Thx,
Sylvain.




Sylvain Juge wrote:

>  the XDoclet output is the following
>  In fact now it doesn't process the Apartement.java file, and I don't know 
> why because It used to process the file before. However, even if the file was 
> processed by xdoclet, there was no result in the repository file, like now 
> when it's not processed, that's why I found it weird.
>  [ojbdoclet] Type kdms.core.Room
>  [ojbdoclet] Type kdms.core.NetworkAddress
>  [ojbdoclet] Type kdms.core.AbstractRoom
>  [ojbdoclet] Processed 3 types
>  [ojbdoclet] Processed 3 types
>  Sylvain.

I tried your classes and they worked without problems with a normal OJB 
1.0.1 (I replaced the NetworkAddressVector with a List because I don't 
know about this class, and I added a dummy NetworkAddress as you didn't 
post it):

---

package kdms.core;

import java.util.List;

/**
  * @ojb.class generate-table-info="false"
  * @ojb.field name="abstractroom_id"
  *primarykey="true"
  *autoincrement="database"
  *jdbc-type="INTEGER"
  */
public class AbstractRoom {
 /** @ojb.field   length="50" */
 protected String ojbConcreteClass;
 /** @ojb.field name="number" */
 protected int number;
 /** @ojb.field name="size" */
 protected float size;
 /**
  * @ojb.collection  name="nAddresses"
  *  element-class-ref="kdms.core.NetworkAddress"
  *  foreignkey="abstractroom_id"
  *  auto-update="true"
  *  auto-retrieve="true"
  *  auto-delete="false"
  */
 protected List nAddresses;
}


package kdms.core;

/**
  * @ojb.class table="abstract_rooms"
  * @ojb.field name="apartment_id"
  *jdbc-type="INTEGER"
  * @ojb.index name="room_unique"
  *unique="true"
  *fields="number,apartment_id"
  */
public class Room extends AbstractRoom {
 /** @ojb.field name="capacity" */
 private int capacity;
}


package kdms.core;

/**
  * @ojb.class table="abstract_rooms"
  * @ojb.field name="testField"
  *jdbc-type="INTEGER"
  */
public class Apartment extends AbstractRoom {}


package kdms.core;

/**
  * @ojb.class table="network_address"
  * @ojb.field name="abstractroom_id"
  *primarykey="true"
  *autoincrement="database"
  *jdbc-type="INTEGER"
  */
public class NetworkAddress {}

---

[ojbdoclet] (XDocletMain.start   47  ) Running 
< ojbrepository/> 
[ojbdoclet] Generating ojb repository descriptor 
(build/resources//repository_user.xml)
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Type kdms.core.Apartment
[ojbdoclet] Processed 4 types
[ojbdoclet] Processed 4 types
[ojbdoclet] (XDocletMain.start   47  ) Running 
< torqueschema/> 
[ojbdoclet] Generating torque schema (build/resources//project-schema.xml)
[ojbdoclet] Processed 4 types

---

< !-- file containing the repository descriptions for user-defined types --> 
< !-- Generated by the xdoclet-ojb module --> 

< class-descriptor
 class="kdms.core.AbstractRoom"
 > 
 < extent-class class-ref="kdms.core.Apartment"/> 
 < extent-class class-ref="kdms.core.Room"/> 
< /class-descriptor> 
< class-descriptor
 class="kdms.core.Apartment"
 table="abstract_rooms"
 > 
 < field-descriptor
 name="abstractroom_id"
 column="abstractroom_id"
 jdbc-type="INTEGER"
 primarykey="true"
 autoincrement="true"
 access="anonymous"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="ojbConcreteClass"
 column="ojbConcreteClass"
 jdbc-type="VARCHAR"
 length="50"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="number"
 column="number"
 jdbc-type="INTEGER"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="size"
 column="size"
 jdbc-type="REAL"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="testField"
 column="testField"
 jdbc-type="INTEGER"
 access="anonymous"
 > 
 < /field-descriptor> 
 < collection-descriptor
 name="nAddresses"
 element-class-ref="kdms.core.NetworkAddress"
 auto-retrieve="true"
 auto-update="true"
 auto-delete="false"
 > 
 < inverse-foreignkey field

Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-14 Thread Thomas Dudziak
Sylvain Juge wrote:
the XDoclet output is the following
In fact now it doesn't process the Apartement.java file, and I don't know why 
because It used to process the file before. However, even if the file was 
processed by xdoclet, there was no result in the repository file, like now when 
it's not processed, that's why I found it weird.
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Processed 3 types
[ojbdoclet] Processed 3 types
Sylvain.
I tried your classes and they worked without problems with a normal OJB 
1.0.1 (I replaced the NetworkAddressVector with a List because I don't 
know about this class, and I added a dummy NetworkAddress as you didn't 
post it):

---
package kdms.core;
import java.util.List;
/**
 * @ojb.class generate-table-info="false"
 * @ojb.field name="abstractroom_id"
 *primarykey="true"
 *autoincrement="database"
 *jdbc-type="INTEGER"
 */
public class AbstractRoom {
/** @ojb.field   length="50" */
protected String ojbConcreteClass;
/** @ojb.field name="number" */
protected int number;
/** @ojb.field name="size" */
protected float size;
/**
 * @ojb.collection  name="nAddresses"
 *  element-class-ref="kdms.core.NetworkAddress"
 *  foreignkey="abstractroom_id"
 *  auto-update="true"
 *  auto-retrieve="true"
 *  auto-delete="false"
 */
protected List nAddresses;
}
package kdms.core;
/**
 * @ojb.class table="abstract_rooms"
 * @ojb.field name="apartment_id"
 *jdbc-type="INTEGER"
 * @ojb.index name="room_unique"
 *unique="true"
 *fields="number,apartment_id"
 */
public class Room extends AbstractRoom {
/** @ojb.field name="capacity" */
private int capacity;
}
package kdms.core;
/**
 * @ojb.class table="abstract_rooms"
 * @ojb.field name="testField"
 *jdbc-type="INTEGER"
 */
public class Apartment extends AbstractRoom {}
package kdms.core;
/**
 * @ojb.class table="network_address"
 * @ojb.field name="abstractroom_id"
 *primarykey="true"
 *autoincrement="database"
 *jdbc-type="INTEGER"
 */
public class NetworkAddress {}
---
[ojbdoclet] (XDocletMain.start   47  ) Running 

[ojbdoclet] Generating ojb repository descriptor 
(build/resources//repository_user.xml)
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Type kdms.core.Apartment
[ojbdoclet] Processed 4 types
[ojbdoclet] Processed 4 types
[ojbdoclet] (XDocletMain.start   47  ) Running 

[ojbdoclet] Generating torque schema (build/resources//project-schema.xml)
[ojbdoclet] Processed 4 types

---














































Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Sylvain Juge
the XDoclet output is the following
In fact now it doesn't process the Apartement.java file, and I don't know why 
because It used to process the file before. However, even if the file was 
processed by xdoclet, there was no result in the repository file, like now when 
it's not processed, that's why I found it weird.
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Processed 3 types
[ojbdoclet] Processed 3 types
Sylvain.




Sylvain Juge wrote:

> Here is the XDoclet schema output (repository_user.xml)
> I removed all irrelevant data to keep it clear.
>   
> 
Ahem, I meant the console output when running Ant. The XDoclet module 
should write out all classes that it processes.

Tom


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


.


Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Thomas Dudziak
Sylvain Juge wrote:
Here is the XDoclet schema output (repository_user.xml)
I removed all irrelevant data to keep it clear.
 

Ahem, I meant the console output when running Ant. The XDoclet module 
should write out all classes that it processes.

Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Sylvain Juge
Here is the XDoclet schema output (repository_user.xml)
I removed all irrelevant data to keep it clear.






























Sylvain Juge wrote:

>  Hi, I'm quite newbie to OJB, and I really need help.
> 
> I've got one base class "AbstractRoom" and two derived classes "Room"
> and "Apartement", and I need to store them in one table named
> "abstract_rooms".
> 
> The problem is that when I generate repository schema for the
> database, it's like if the Apartement class is dropped (even if
> Xdoclet process the source file), because it is not present in the
> resulting repository file, thus absent of AbstractRoom extends.
> Despite abstract_rooms table contains all columns from Rooms class,
> there is no one from Apartement.
> It seems that my class "Apartement" is not seen by XDoclet as a
> persitence capable class, or simply "forget" my class and I wonder
> what Am I doing wrong.
>   
> 
Could you post the output of the XDoclet module ? Do you get any 
error/warning messages ?
You can also try running Ant with the -v commandline option to get some 
more output.

Tom


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


.


Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Thomas Dudziak
Sylvain Juge wrote:
Hi, I'm quite newbie to OJB, and I really need help.
I've got one base class "AbstractRoom" and two derived classes "Room"
and "Apartement", and I need to store them in one table named
"abstract_rooms".
The problem is that when I generate repository schema for the
database, it's like if the Apartement class is dropped (even if
Xdoclet process the source file), because it is not present in the
resulting repository file, thus absent of AbstractRoom extends.
Despite abstract_rooms table contains all columns from Rooms class,
there is no one from Apartement.
It seems that my class "Apartement" is not seen by XDoclet as a
persitence capable class, or simply "forget" my class and I wonder
what Am I doing wrong.
 

Could you post the output of the XDoclet module ? Do you get any 
error/warning messages ?
You can also try running Ant with the -v commandline option to get some 
more output.

Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]