-
1. Re: pvm wiki
tom.baeyens Aug 28, 2007 10:49 AM (in response to tom.baeyens)Guillaume, could you comment on the status of the persistence issues ? I would like to know which of those issues you have solutions for. I think that we need to focus on those issues before we further build out the persistence mapping coverage.
-
2. Re: pvm wiki
mvaldes Aug 29, 2007 1:30 PM (in response to tom.baeyens)
I want that the database model is designed very carefully. To do that we'll need to have a way on producing graphical ER diagrams. Anyone got an idea on how to do that ?
What about using an Eclipse plugin allowing UML diagrams definition ? I've tried this one and seems to work fine: http://topcased-mm.gforge.enseeiht.fr/website/modeling/uml/download.html
regards,
Miguel Valdes -
3. Re: pvm wiki
porcherg Aug 30, 2007 9:13 AM (in response to tom.baeyens)we added some comments to the wiki.
Goulven and Guillaume -
4. Re: pvm wiki
porcherg Sep 3, 2007 7:57 AM (in response to tom.baeyens)I updated the status of the persistence issues.
I have problems with "How to prevent clashes between comparing an object with it's proxy.".
Do you have an example of a situation where this clash occurs ?
Guillaume -
5. Re: pvm wiki
tom.baeyens Sep 3, 2007 9:54 AM (in response to tom.baeyens)i explained it to charles. can you check if he remembers it ?
-
6. Re: pvm wiki
tom.baeyens Sep 3, 2007 10:03 AM (in response to tom.baeyens)* creation can be done with xml properties (for hibernate <property name="hibernate.hbm2ddl.auto" value="create" /> possible values are: validate | update | create | create-drop)
the difficulty here is to make it work in a test suite as well as running just 1 test.
It can be done with a static, updatable singleton class. All db tests should get their configuration (EnvironmentFactory) from a central static location wiht the singleton pattern. If no configuration is present a default one should be created (for hibernate, with hsqldb in memory).
The overall test suites that includes many configurations can use the TestSetup classes as you have indicated. Then the TestSetup classes can initialize/overwrite the static configuration (EnvironmentFactory)
If you had the same in mind, please add the previous to the wiki. otherwise discuss here further.
* cleaning tables is more difficult. I tried to use jdbc connection, but it's not easy to use and it does not really work. We have to investigate further.
i don't really get this
create-drop for me is fine. but we'll have to find something similar with the other persistence providers/.
* hibernate can drop created tables at the end of the test (when using create-drop property)
should be at the end of each TestSetup
* toplink can drop existing tables before the creation of the needed tables.
don't get the point of this remark
* Note: schema generation takes a lot of time and should probably be skipped in production environment.
We should make sure that *minimal* schema generation is done. Especially not inbetween tests. Inbetween tests, theh database should be cleaned (= drop constraints, delete all rows from all tables and recreate constraints) -
7. Re: pvm wiki
porcherg Sep 3, 2007 10:32 AM (in response to tom.baeyens)
* hibernate can drop created tables at the end of the test (when using create-drop property)
should be at the end of each TestSetup
Hibernate drops the tables when the EntityManagerFactory/SessionFactory is closed (that can be at the end of the TestSetup or when the EnvironmentFactory is closed). I don't know if we can reopen a closed SessionFactory.
* toplink can drop existing tables before the creation of the needed tables.
don't get the point of this remark
toplink can drop existing tables before creating the db scheme. I don't know how to drop the tables at the end of the test. So we don't have yet a 'create-drop' for toplink.
* cleaning tables is more difficult. I tried to use jdbc connection, but it's not easy to use and it does not really work. We have to investigate further.
i don't really get this
Create-drop creates tables when the EntityManagerFactory is created, and drops them when it's closed. As we don't want to do this between each test, I tried to find a method to clean the db.
The first problem is to find the list of tables to clean.
The second problem is to clean them.
I don't have a solution which works for these problems.
Guillaume -
8. Re: pvm wiki
tom.baeyens Sep 3, 2007 10:50 AM (in response to tom.baeyens)"porcherg" wrote:
* hibernate can drop created tables at the end of the test (when using create-drop property)
should be at the end of each TestSetup
Hibernate drops the tables when the EntityManagerFactory/SessionFactory is closed (that can be at the end of the TestSetup or when the EnvironmentFactory is closed). I don't know if we can reopen a closed SessionFactory.
you don't need to reopen a closed session factory. why do you think that ?"porcherg" wrote:
* toplink can drop existing tables before the creation of the needed tables.
don't get the point of this remark
toplink can drop existing tables before creating the db scheme. I don't know how to drop the tables at the end of the test. So we don't have yet a 'create-drop' for toplink.
ah. now i get it.
that might not be a problem for continious integration, though."porcherg" wrote:
* cleaning tables is more difficult. I tried to use jdbc connection, but it's not easy to use and it does not really work. We have to investigate further.
i don't really get this
Create-drop creates tables when the EntityManagerFactory is created, and drops them when it's closed. As we don't want to do this between each test, I tried to find a method to clean the db.
The first problem is to find the list of tables to clean.
The second problem is to clean them.
I don't have a solution which works for these problems.
Guillaume
jbpm has got this. so you could look there and do similar things: in JbpmSchema you can find this:public String[] getCleanSql() { if (cleanSql==null) { // loop over all foreign key constraints List dropForeignKeysSql = new ArrayList(); List createForeignKeysSql = new ArrayList(); Iterator iter = configuration.getTableMappings(); while ( iter.hasNext() ) { Table table = ( Table ) iter.next(); if ( table.isPhysicalTable() ) { Iterator subIter = table.getForeignKeyIterator(); while ( subIter.hasNext() ) { ForeignKey fk = ( ForeignKey ) subIter.next(); if ( fk.isPhysicalConstraint() ) { // collect the drop foreign key constraint sql dropForeignKeysSql.add( fk.sqlDropString( dialect, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA) ) ); // and collect the create foreign key constraint sql createForeignKeysSql.add( fk.sqlCreateString( dialect, mapping, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA) ) ); } } } } List deleteSql = new ArrayList(); iter = configuration.getTableMappings(); while (iter.hasNext()) { Table table = (Table) iter.next(); deleteSql.add("delete from "+table.getName()); } // glue // - drop foreign key constraints // - delete contents of all tables // - create foreign key constraints // together to form the clean script List cleanSqlList = new ArrayList(); cleanSqlList.addAll(dropForeignKeysSql); cleanSqlList.addAll(deleteSql); cleanSqlList.addAll(createForeignKeysSql); cleanSql = (String[]) cleanSqlList.toArray(new String[cleanSqlList.size()]); } return cleanSql; }
does that help you further ? -
9. Re: pvm wiki
mvaldes Sep 17, 2007 11:09 AM (in response to tom.baeyens)The wiki page for persistence has been updated. Guillaume has divided this page into solved and pending issues.
I have also updated the items to be addressed during the next meeting.
regards,
Miguel Valdes