ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nic Werner <wer...@sonoma.edu>
Subject Re: SQL Map Configuration with Many tables and Domain classes
Date Wed, 13 Apr 2005 16:22:36 GMT
With my ever-present example, this works:

Devices and Reservations exist.
Reservations can hold Devices, but Devices can also be accessed 
independently - hence seperate config files

In my sqlMapConfig, the order of declaration is: Device, Reservation

Calling 'selectDevice' statement from Reservation.xml works fine.

- Nic.



Sasha Borodin wrote:

>I think the order in which they are declared in your sql-map-config file is
>relevant.  Please confirm though.
>
>-Sasha
>
>
>  
>
>>From: Brandon Goodin <brandon.goodin@gmail.com>
>>Reply-To: <ibatis-user-java@incubator.apache.org>
>>Date: Wed, 13 Apr 2005 10:00:54 -0600
>>To: <ibatis-user-java@incubator.apache.org>, <werner@sonoma.edu>
>>Subject: Re: SQL Map Configuration with Many tables and Domain classes
>>
>>As far as i know you should be able to refer to any sqlmap regardless
>>of whether it is in another xml file and/or namespace. If you can't it
>>is a bug.
>>
>>Brandon
>>
>>On 4/13/05, Nic Werner <werner@sonoma.edu> wrote:
>>    
>>
>>>On  a quick note about namespaces and such: If I have two xml files for
>>>different tables, can I refer to one of the statements in the other
>>>file, like if I was calling a statement in a resultMap? Or are they only
>>>available locally in that file?
>>>
>>>- Nic.
>>>
>>>Brandon Goodin wrote:
>>>
>>>      
>>>
>>>>What you want to do is perfectly acceptable. The namespace is used
>>>>when you call your sqlmap
>>>>queryForObject("MyNameSpace.myMappedStatement",myObject). So, the
>>>>namespace is arbitrary. You can name it whatever you like.
>>>>
>>>>Brandon
>>>>
>>>>On 4/13/05, Jason Hall <JHall@cihi.ca> wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi,
>>>>>
>>>>>I have about 200 tables and what i've done is group certain child tables
in
>>>>>a logical domain.
>>>>>Don't want to deal with so many scattered xml files for each table.
>>>>>
>>>>>For example:
>>>>>
>>>>>If I had parent table PERSON and 3 child tables say PERSON_CHILD1,
>>>>>PERSON_CHILD2, PERSON_CHILD3
>>>>>
>>>>>can I create one sqlmap file say Person.xml
>>>>>
>>>>>and then in the file will be ...
>>>>>
>>>>><sqlMap namespace="person">
>>>>>
>>>>>        <!-- PERSON -->
>>>>><typeAlias alias="person" type="com.yah.nah.Person" />
>>>>>
>>>>><insert id="insertPerson" parameterClass="person" >
>>>>>
>>>>>   insert into ......
>>>>>
>>>>></insert>
>>>>>
>>>>>
>>>>>        <!-- PERSON_CHILD1 -->
>>>>><typeAlias alias="personchild1" type="com.yah.nah.PersonChild1" />
>>>>>
>>>>><insert id="insertPersonChild1" parameterClass="personchild1" >
>>>>>
>>>>>   insert into ......
>>>>>
>>>>></insert>
>>>>>
>>>>>        <!-- PERSON_CHILD2 -->
>>>>><typeAlias alias="personchild2" type="com.yah.nah.PersonChild2" />
>>>>>
>>>>><insert id="insertPersonChild2" parameterClass="personchild2" >
>>>>>
>>>>>   insert into ......
>>>>>
>>>>></insert>
>>>>>
>>>>>        <!-- PERSON_CHILD3 -->
>>>>><typeAlias alias="personchild3" type="com.yah.nah.PersonChild3" />
>>>>>
>>>>><insert id="insertPersonChild3" parameterClass="personchild3" >
>>>>>
>>>>>   insert into ......
>>>>>
>>>>></insert>
>>>>>
>>>>>
>>>>></sqlMap>
>>>>>
>>>>>
>>>>>So is this legal to do with using many typeAliases and using
>>>>>parameterClass
>>>>>for 3 different domain classes as noted in the example ?
>>>>>
>>>>>Also can the namespace be anything other than the actual domain you are
>>>>>acting on for example if the domain is Person can the namespace be
>>>>>Personer(just want to know if this is possible)?
>>>>>
>>>>>please help.
>>>>>
>>>>>Thanks!
>>>>>
>>>>>Jason Hall
>>>>>
>>>>>
>>>>>          
>>>>>
>>>      
>>>
>
>
>  
>


Mime
View raw message