private void removeDuplicatedProjects ( DbSession session , String projectKey ) { List < ComponentDto > duplicated = dbClient . componentDao ( ) . selectComponentsHavingSameKeyOrderedById ( session , projectKey ) ; for ( int i = 1 ; i < duplicated . size ( ) ; i ++ ) { dbClient . componentDao ( ) . delete ( session , duplicated . get ( i ) . getId ( ) ) ; } }
On MySQL as PROJECTS . KEE is not unique if the same project is provisioned multiple times then it will be duplicated in the database . So after creating a project we commit and we search in the db if their are some duplications and we remove them .