LOL... I mean...

Are you ConfORM ?

2010/3/4 Fabio Maulo <[email protected]>

> Classes:
> public class Endereco
> {
>  public int Id { get; set; }
> public string Rua { get; set; }
> public int Numero { get; set; }
>  }
> public class Pessoa
> {
>  public int Id { get; set; }
>
> public Endereco Residencial { get; set; }
>  public Endereco Comercial { get; set; }
> public Endereco Entrega { get; set; }
>  public Endereco Correspondencia { get; set; }
> }
>
> Mapping using ConfORM:
>  public void MapDomain(ObjectRelationalMapper orm)
> {
> orm.TablePerClass<Pessoa>();
>  orm.TablePerClass<Endereco>();
> orm.Cascade<Pessoa, Endereco>(Cascade.Persist | Cascade.Refresh |
> Cascade.Merge);
>  }
>
> Exporting ConfORM to XML:
> <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> namespace="TryConfORM.EvertonLucas" assembly="TryConfORM"
> xmlns="urn:nhibernate-mapping-2.2">
>   <class name="Pessoa">
>     <id name="Id" type="Int32">
>       <generator class="hilo" />
>     </id>
>     <many-to-one name="Residencial" cascade="save-update,
> persist,refresh,merge" />
>     <many-to-one name="Comercial" cascade="save-update,
> persist,refresh,merge" />
>     <many-to-one name="Entrega" cascade="save-update,
> persist,refresh,merge" />
>     <many-to-one name="Correspondencia" cascade="save-update,
> persist,refresh,merge" />
>   </class>
>   <class name="Endereco">
>     <id name="Id" type="Int32">
>       <generator class="hilo" />
>     </id>
>     <property name="Rua" />
>     <property name="Numero" />
>   </class>
> </hibernate-mapping>
>
> Are you CondORM?
>
> 2010/3/4 Everton Lucas <[email protected]>
>
> Ok... Understood.
>>
>> But do I need to implement collections in class Endereco?
>>
>> On 4 mar, 12:31, Fabio Maulo <[email protected]> wrote:
>> > Everton... they are simple many-to-one
>> >
>> > 2010/3/4 Everton Lucas <[email protected]>
>> >
>> >
>> >
>> > > No. One person has zero or one EnderecoResidencial, EnderecoComercial,
>> > > EnderecoEntrega and EnderecoCorrespondencia, and all of these members
>> > > are objects from class Endereco.
>> >
>> > > For members of class Endereco, the person has members describing each
>> > > member, like Number and some observations about the address. Using
>> > > this structure the user doesn't need to retype the same address for
>> > > each customer, for example.
>> >
>> > > So, improving the example, the class people will implemented (more
>> > > completely) as follows:
>> >
>> > > class Pessoa {
>> > >  ...
>> > >  Endereco endResidencial; // Home address.
>> > >   int numero; // Number of address above
>> > >  Endereco endComercial; // Job address
>> > >  int numero; // Number of address above.
>> > >  Endereco endEntrega; // Deliver address.
>> > >  int numero; // Number of address above
>> > >   Endereco endCorrespondencia; // Something like an address to send
>> > > mails. Could be different of home address
>> > >   int numero; // Number of address above
>> > >  ...
>> >
>> > > }
>> >
>> > > On 4 mar, 09:35, Fabio Maulo <[email protected]> wrote:
>> > > > aaahhh... so you don't have a collection for each property in
>> Pessoa...
>> > > > should be easy and I prefer the other challenge where
>> > > > public ICollection<Endereco> Residencial
>> > > > public ICollection<Endereco> Comercial
>> > > > .....
>> > > > ....
>> > > > and all relations should be stored in the same table.
>> >
>> > > > 2010/3/4 Everton Lucas <[email protected]>
>> >
>> > > > > Endereco is an entity.
>> >
>> > > > > Before I send this issue, I thought to implement as follows
>> >
>> > > > > class Pessoa {
>> > > > >  ...
>> > > > >  Endereco endResidencial; // Home address.
>> > > > >  Endereco endComercial; // Job address.
>> > > > >  Endereco endEntrega; // Deliver address.
>> > > > >  Endereco endCorrespondencia; // Something like an address to send
>> > > > > mails. Could be different of home address
>> > > > >  ...
>> > > > > }
>> >
>> > > > > class Endereco {
>> > > > >  String logradouro; // Street
>> > > > >  String cep; // zip code
>> > > > >  String cidade; // city
>> > > > >  String uf; // State
>> > > > >  String bairro; // ward
>> > > > > }
>> >
>> > > > > My real question is: Can I implement these classes above? So, I
>> have a
>> > > > > second question: How can I translate these classes into hbm files?
>> >
>> > > > > On 4 mar, 01:08, Fabio Maulo <[email protected]> wrote:
>> > > > > > Endereco, is an entity or a ValueObject (component) ?
>> >
>> > > > > > 2010/3/3 Socratees Samipillai <[email protected]>
>> >
>> > > > > > > I guess this should help you.
>> >
>> > > > > > > class A
>> > > > > > > {
>> > > > > > >     ISet<B> X;
>> > > > > > > }
>> >
>> > > > > > > class B
>> > > > > > > {
>> > > > > > >     ISet<A> Y;
>> > > > > > > }
>> >
>> > > > > > > A.hbm.xml
>> >
>> > > > > > > <set name="X" table="XXX" generic="true" where="if you have
>> any not
>> > > > > null
>> > > > > > > checks here, go for it." inverse="true or false" lazy="true">
>> > > > > > >     <key column="B_ID"/>
>> > > > > > >     <many-to-many class="B, DLL" column="B_ID"
>> not-found="ignore"/>
>> > > > > > > </set>
>> >
>> > > > > > > B.hbm.xml
>> >
>> > > > > > > <set name="Y" table="YYY" generic="true" where="if you have
>> any not
>> > > > > null
>> > > > > > > checks here, go for it." inverse="true or false" lazy="true">
>> > > > > > >     <key column="A_ID" />
>> > > > > > >     <many-to-many class="A, DLL" column="A_ID"
>> not-found="ignore"
>> > >  />
>> > > > > > > </set>
>> >
>> > > > > > > Also refer these manuals.
>> >
>> > >https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/
>> >
>> > >https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/m.
>> > > > > ..
>> >
>> > > > > > > For a many to many association where items can be duplicates,
>> you
>> > > > > should be
>> > > > > > > using a *bag* on both mapping files. A bag is unordered and
>> > > unindexed,
>> > > > > > > where as a set is unique.
>> >
>> > > > > > > I would also strongly suggestwww.summerofnhibernate.com
>> >
>> > > > > > > Socratees.
>> >
>> > > > > > > 2010/3/3 Everton Lucas <[email protected]>
>> >
>> > > > > > > Hi People
>> >
>> > > > > > >> I need to know how can I implement classes and hbm files
>> > > demonstrated
>> > > > > in
>> > > > > > >> the uml diagram attached. I really don't know if there is a
>> way to
>> > > > > implement
>> > > > > > >> that without IList and bag tag.
>> >
>> > > > > > >> Thanks in advance
>> > > > > > >> Everton Lucas
>> >
>> > > > > > >> --
>> > > > > > >> You received this message because you are subscribed to the
>> Google
>> > > > > Groups
>> > > > > > >> "nhusers" group.
>> > > > > > >> To post to this group, send email to
>> [email protected].
>> > > > > > >> To unsubscribe from this group, send email to
>> > > > > > >> [email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> >
>> > > > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> >
>> > > > > > >> .
>> > > > > > >> For more options, visit this group at
>> > > > > > >>http://groups.google.com/group/nhusers?hl=en.
>> >
>> > > > > > >  --
>> > > > > > > You received this message because you are subscribed to the
>> Google
>> > > > > Groups
>> > > > > > > "nhusers" group.
>> > > > > > > To post to this group, send email to [email protected]
>> .
>> > > > > > > To unsubscribe from this group, send email to
>> > > > > > > [email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> >
>> > > > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> >
>> > > > > > > .
>> > > > > > > For more options, visit this group at
>> > > > > > >http://groups.google.com/group/nhusers?hl=en.
>> >
>> > > > > > --
>> > > > > > Fabio Maulo
>> >
>> > > > > --
>> > > > > You received this message because you are subscribed to the Google
>> > > Groups
>> > > > > "nhusers" group.
>> > > > > To post to this group, send email to [email protected].
>> > > > > To unsubscribe from this group, send email to
>> > > > > [email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > <nhusers%[email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> >
>> > > > > .
>> > > > > For more options, visit this group at
>> > > > >http://groups.google.com/group/nhusers?hl=en.
>> >
>> > > > --
>> > > > Fabio Maulo
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> Groups
>> > > "nhusers" group.
>> > > To post to this group, send email to [email protected].
>> > > To unsubscribe from this group, send email to
>> > > [email protected]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> >
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/nhusers?hl=en.
>> >
>> > --
>> > Fabio Maulo
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>
>
> --
> Fabio Maulo
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to