[ 
https://issues.apache.org/jira/browse/CAY-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Friederich Christophe updated CAY-1922:
---------------------------------------

    Description: 
If you are more than one DataNode, the first create all tables and the second 
failed because it try create all tables again ( if the strategy is the same).

#processSchemaUpdate method searches all DbEntity with 
dataNode.getEntityResolver().getDbEntities(), but getEntityResolver() contains 
all DbEntity for all DataNode.
{code}
I resolve the problem replacing this line with:
Set<DbEntity> entities = Sets.newHashSet();
Collection<DataMap> map = dataNode.getDataMaps();
for (DataMap dataMap : map) {
      entities.addAll(dataMap.getDbEntities());
}
{code}

  was:
processSchemaUpdate method search all DbEntity with 
dataNode.getEntityResolver().getDbEntities(), but getEntityResolver() contains 
all DbEntity from all DataNode.

I resolve the problem replacing this line with:
Set<DbEntity> entities = Sets.newHashSet();
Collection<DataMap> map = dataNode.getDataMaps();
for (DataMap dataMap : map) {
      entities.addAll(dataMap.getDbEntities());
}



> CreateIfNoSchemaStrategy generates all table of all DataNode
> ------------------------------------------------------------
>
>                 Key: CAY-1922
>                 URL: https://issues.apache.org/jira/browse/CAY-1922
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 3.2M1
>            Reporter: Friederich Christophe
>
> If you are more than one DataNode, the first create all tables and the second 
> failed because it try create all tables again ( if the strategy is the same).
> #processSchemaUpdate method searches all DbEntity with 
> dataNode.getEntityResolver().getDbEntities(), but getEntityResolver() 
> contains all DbEntity for all DataNode.
> {code}
> I resolve the problem replacing this line with:
> Set<DbEntity> entities = Sets.newHashSet();
> Collection<DataMap> map = dataNode.getDataMaps();
> for (DataMap dataMap : map) {
>       entities.addAll(dataMap.getDbEntities());
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to