ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean Guillaume LALANNE - Capgemini" <ext.jglala...@cma-cgm.com>
Subject Dao
Date Tue, 08 Feb 2005 08:31:42 GMT
 

Hi,

 

I am currently trying to reengineer my application. In fact, right now, this
one is using patched IBATIS dll in order to be able to use several dao
contexts with different daoSessionHandler. According to Gilles BAYON, the
patch we have developped is due to our misunderstanding of the way we have
to use IBATIS framework (see below the discussion with Gilles Bayon – sorry
this is in french).

So because I am pretty sure he is right and we are not (I am not able to
build up such a framework), I am trying to find out the correct way we have
to follow in our application, but still I don’t manage to do so.

It is pretty important for us to follow the right IBATIS dlls because
otherwise, we won’t be able to upgrade smoothly our application in parallel
to ibatis.

 

So if anybody can help us, I would be very kind of him.

 

My problem is the following:

 

I get an error (with the right ibatis dlls) at the BaseSQLMapDao level. It
is returning me a wrong SQLMap, because the line below:

 

“ SqlMapDaoSession sqlMapDaoSession =
(SqlMapDaoSession)daoManager.LocalDaoSession; »

 

is always returning me the last SqlMapDaoTransaction defined in the
configuration file (wimbv2Dao.config attachment file), so here the
statisticsSqlMapDao …

I am wondering also why the daoSessionHandler have always the same name =
SqlMap. Is it normal ? Maybe during the configuration loading, the objects
are overwritten by each other in a hashmap or something like this because of
the common key name (SQLMap)??

 

There is something I don’t understand certaintly, but where???

 

Best regards,

 

Jean-Guillaume LALANNE

 

 

  _____  

De : gilles.bayon@laposte.net [mailto:gilles.bayon@laposte.net] 
Envoyé : mardi 7 décembre 2004 14:44
À : ho.jglalanne
Objet : RE: svn version

 

Qq remarques

Vous devez avoir un seul ServiceConfig qui doit ressembler à celui ce
dessous, idem pour le dao.config.
Essayez comme celà, cela marche très bien ds les tests unitaires.

 

J'étudierais plus en profonduer ce soir le prb

=============================
 /// <summary>
 /// Summary description for ServiceConfig.
 /// </summary>
 public class ServiceConfig
 {
  static private object _synRoot = new Object();
  static private ServiceConfig _instance;

  private DaoManager _daoManagerWin = null;
   private DaoManager _daoManagerLara = null;

  /// <summary>
  /// Remove public constructor. prevent instantiation.
  /// </summary>
  private ServiceConfig(){}

  static public ServiceConfig GetInstance()
  {
   if (_instance==null)
   {
    lock(_synRoot)
    {
     if (_instance==null)
     {
      try
      {
       ConfigureHandler handler = new ConfigureHandler( ServiceConfig.Reset
);
       DaoManager.ConfigureAndWatch( handler );
      }
      catch(Exception e)
      {
       Console.WriteLine(e.Message);
      }

      _instance = new ServiceConfig();
      
      _instance._daoManagerWin = DaoManager.GetInstance("WimbSqlMapDao");
      _instance._daoManagerLara = DaoManager.GetInstance("LaraSqlMapDao");

     }
    }
   }
   return _instance;
  }


  /// <summary>
  /// Reset the singleton
  /// </summary>
  /// <remarks>
  /// Must verify ConfigureHandler signature.
  /// </remarks>
  /// <param name="obj">
  /// </param>
  static public void Reset(object obj)
  {
   _instance =null;
  }

  public DaoManager DaoManagerWin
  {
   get
   {
    return _daoManagerWin;
   }
  }

  public DaoManager DaoManagerLara
  {
   get
   {
    return _daoManagerLara;
   }
  }

 }
}
==============================
et un seul dao.config qui doit ressembler à celà
<?xml version="1.0" encoding="utf-8"?>
<daoConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DaoConfig.xsd">
  
 <context name="WimbSqlMapDao">
  <daoSessionHandler name="SqlMap">
   <property name="sqlMapConfigFile" value="wimbSqlMap.config"/>
  </daoSessionHandler>
  
  <database>
   <provider name="Oracle9i"/>       
   <dataSource name="OracleWimb" connectionString="User
ID=WIMB1;Password=WIMB1;Data Source=DIVA"/>
  </database>
  
  <daoFactory assembly="wimbv2.persistence.dll">
   <dao name="BLHeaderDao"
implementation="com.cmacgm.persistence.wimb.dao.impl.BLHeaderDao"/>  
   <dao name="PassportDao"
implementation="com.cmacgm.persistence.wimb.dao.impl.PassportDao"/> 
  </daoFactory>
  
 </context>

 <context name="LaraSqlMapDao">
  <daoSessionHandler name="SqlMap">
   <property name="sqlMapConfigFile" value="laraSqlMap.config"/>
  </daoSessionHandler>
  
  <database>
   <provider name="Oracle9i"/>       
   <dataSource name="OracleLara" connectionString="User
ID=SCE_VISU;Password=SCE_VISU;Data Source=LARA_QUA"/>
  </database>
  
  <daoFactory assembly="wimbv2.persistence.dll">
   <dao name="JobHeadersDao"
implementation="com.cmacgm.persistence.lara.dao.impl.JobHeadersDao"/>   
   <dao name="ResourceDao"
implementation="com.cmacgm.persistence.lara.dao.impl.ResourceDao"/>   
  </daoFactory>
  
 </context>
 
</daoConfig>

===============================================

 

Les DLLs liées à IBATIS sont celles que nous avons créées avec le patch.

Il faut donc les changer.

 

Cldt,

 

Jean-Guillaume LALANNE

 

> 

  _____  

De : gilles.bayon@laposte.net [mailto:gilles.bayon@laposte.net] 
Envoyé : mardi 7 décembre 2004 10:54
À : ho.jglalanne
Objet : RE: svn version

 

> 

> 

Il ya déja des tests unitaire avec de multiple dao context (sqlMap +
nhibernate) et il marche tous !

> 

Le patch que vous me proposer est incorrect, il doit y avoir un prb mais
autre part.

> 

Pour le corriger il faudrait me fournir un test unitaire qui reproduit ce
bug, ou les sources  cs+ config + bdd qui provoque ce bug

> 

 

> 

Cordialement

> 

-Gilles

> 

 

> 

====================

> 

Hi Gilles,

 

The dao.config file I sent you was not the good one. Sorry.

If you test the current framework version (1.1) with multiple contexts, you
should

find out the bug we described in our previous mail.

The patch should correct this bug normally.

 

Regards,

 

Jean-Guillaume

 

Ps: vu qu’on communique directement de l’un à l’autre sans passer par la
mailing-list, il serait peut-être plus simple de converser en francais…

J’ai du mal avec l’anglais….

 

> 

> 

  _____  

De : gilles.bayon@laposte.net [mailto:gilles.bayon@laposte.net] 
Envoyé : mardi 7 décembre 2004 09:54
À : ho.jglalanne
Objet : RE: svn version

 

> 

> 

> 

> 

As I can see, I don't understand your patch.

> 

> 

I gess you have an invalid dao.config, your second dao context have an
invalid property sqlMapConfigFile (it's the same as the first contex !)

> 

> 

<property name="sqlMapConfigFile" value="SqlMap.config"/>

it must be (no ?)

<property name="sqlMapConfigFile" value="SqlMapProduct.config"/>

> 

> 

==================================

> 

> 

Thanks for the URL.

We have tested with the last ibatisnet version and it seems that the bug
that we have corrected does still exist in this version 1.1.

The patch we have sent you on Friday is still necessary.

 

Regards

 

Jean-Guillaume LALANNE

 

 

> 

> 

> 

  _____  

De : gilles.bayon@laposte.net [mailto:gilles.bayon@laposte.net] 
Envoyé : lundi 6 décembre 2004 13:42
À : ho.jglalanne
Objet : Re:svn version

 

The iBATIS.Net project use Subversion for the source code control software.
The repository is hosted at  <http://wush.net/> http://wush.net. 
 
To check out the source from the repository, you must use one of the
following clients:  
 
* TortoiseSVN is a Windows Explorer plugin which integrates well with
Windows and allows access to the repository from outside the development
IDE.  
* AnkhSVN is a plugin for Visual Studio.NET and allows you to checkout the
source from within the Microsoft development tool. 
 
The location of repository is 
 <https://wush.net/svn/ibatisnet1/Source1/>
https://wush.net/svn/ibatisnet1/Source1/  
login : guest 
pass: guest 
 
Cheer 
-Gilles 

> 

> 

> 

> 

> 

> 

 

> 

> 

> 

 

> 

> 

> 

Accédez au courrier électronique de La Poste : www.laposte.net ;

> 

> 

> 

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

> 

> 

> 

> 

 

> 

> 

 

> 

> 

Accédez au courrier électronique de La Poste : www.laposte.net ;

> 

> 

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

> 

> 

 

> 

 

> 

Accédez au courrier électronique de La Poste : www.laposte.net ;

> 

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

 

 

Accédez au courrier électronique de La Poste : www.laposte.net ;

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)


Mime
View raw message