Hey Patrick,

I am facing this problem.

Consider this..similar like your example.

Entity Inventory{
  - List<@Item> items 
}
Entity Item{
}

This generates an additional table INVENTORY_ITEM which I dont want
(many-2-many relationship.)
I want to have unidiretional relationship(one-2-many) as only inventory can
have items.

Now If I do the following

CASE:1

Entity Inventory{
  - List<@Item> items inverse
}

I see a reference of INVENTORY in item table which is not expected.
CREATE TABLE ITEM (
  ITEM_ID NUMBER(20) NOT NULL,
  INVENTORY NUMBER(20)  ,
);

What I want to have is just below and there should no reference of Inventory
in Item table.

CREATE TABLE INVENTORY (
     INVENTORY_ID NUMBER(20) NOT NULL,
     ITEM_ID NUMBER(20) NOT NULL,
)

CASE 2:

I did the following(Not sure why but I read somewhere that inverse creates a
reference in the child table)
As such the following doesnt look correct to me but still I tried

Entity Inventory{
 }
Entity Item{
    - List<@Inventory> inv inverse
}

It does this which seems okk...although it creates this INV_INDEX(INTEGER)
which I'll have to fix somehow to make NUMBER

CREATE TABLE INVENTORY (
  INVENTORY_ID NUMBER(20) NOT NULL,
  INV_INDEX INTEGER(10),
  ITEM NUMBER(20)            
);

This is fine so far....but in Item.hbm.xml I see
<list name="inv"> 
      <key column="ITEM"/>  
      <index column="INV_INDEX"/>  
      <one-to-many class="com.bookonz.inventory.domain.Inventory"/> 
    </list>  

I am not sure if this is correct? Should Item.hbm hold a reference to
Inventory?


Please provide your inputs on this.

Thanks,
Deepak.


Patrik Nordwall wrote:
> 
> Do you need something like this, i.e. Moon doesn't refer back to Planet?
> 
> Entity Planet {
>    - @Set<Moon> moons
> }
> 
> Entity Moon {
> }
> 
> 
> This will result in a uni-directional many association, but will be
> implemented in the database as many-to-many.
> 
> To implement it with an ordinary foreign key in the child table you have
> to add inverse
> 
> Entity Planet {
>    - @Set<Moon> moons inverse
> }
> 
> Doc:
> http://www.fornax-platform.org/cp/display/fornax/3.+Advanced+Tutorial+(CSC)#3.AdvancedTutorial(CSC)-AdditionalReferenceFeatures
> 
> /Patrik
> 
> 
> polly.c.chang wrote:
>> 
>> Hi,
>> 
>> Is it possible to map a uni-directional one-to-many mapping?  From
>> looking at the documentation and template code, it looks like one has to
>> mark the Reference as "inverse", which is a bi-directional mapping.  I
>> just want to have a simple uni-directional mapping.
>> 
>> Thanks!
>> --Polly
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-Sculptor--uni-directional-one-to-many-mapping--tp21445883s17564p23711843.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to