Cardinality for the source end of a unidirectional association doesn't make
sense.


Darth wrote:
> 
> How do I figure out the cardinality of the source end, for a
> unidirectional relation (opposite = null)
> So I was doing something like this (still rough)
> 
> «IF opposite != null»
>       «REM»Bi-directional«ENDREM»
>       «IF this.many && !opposite.many»
>       @javax.persistence.OneToMany(mappedBy="«opposite.name.toFirstLower()»")
>       «ELSEIF this.many && opposite.many»
>       @javax.persistence.ManyToMany(mappedBy="«opposite.name.toFirstLower()»")
>       «ELSEIF !this.many && !opposite.many»
>       @javax.persistence.OneToOne
>       @javax.persistence.JoinColumn(name="«getForeignKeyName()»")
>       «ELSEIF !this.many && opposite.many»    
>       @javax.persistence.ManyToOne
>       @javax.persistence.JoinColumn(name="«getForeignKeyName()»")
>       «ENDIF»
> «ELSE»
>       «REM»Uni-directional«ENDREM»
>       «IF this.many && the source is not many» <---------
>       @javax.persistence.OneToMany
>       «ELSEIF this.many && source is many» <---------
>       @javax.persistence.ManyToMany
>       «ELSEIF !this.many && source is not many» <---------
>       @javax.persistence.OneToOne
>       «ELSEIF !this.many && source is many»   <---------  
>       @javax.persistence.ManyToOne
> «ENDIF»
> «ENDIF»
> 
> 
> The bold parts in ELSE I need to fix further...
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-figure-out-if-a-relation-%28reference%29-is-Bi-Directional--tp18099001s17564p18099831.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to