From: Jean-Marc R. <jea...@su...> - 2014-04-30 08:18:13
|
I want to add an index to an existing field in an existing store as per the following xml snippet: <persistable class-name="sjs.me.mycrm.domain.order.OrderBean" record-store-name="Order" > <indexes> <index name="byCustomer" > <field>customerID</field> </index> <!-- New index on existing field: <index name="byStatus" > <field>status</field> </index> --> </indexes> </persistable> However, Floggy migration fails as per this stack trace: java.lang.RuntimeException: Class and RMS description doesn't match for class sjs.me.mycrm.domain.order.OrderBean. Please execute a migration first. - net.sourceforge.floggy.persistence.migration.MigrationManager.getInstance(Mi grationManager.java:101) - sjs.me.mycrm.domain.dao.DatabaseManagerRoot.<init>(DatabaseManagerRoot.java: 54) - sjs.me.mycrm.domain.dao.floggy.DatabaseManagerImpl.<init>(DatabaseManagerImp l.java:62) - sjs.me.mycrm.domain.dao.floggy.DatabaseManagerImpl.initialize(DatabaseManage rImpl.java:52) - sjs.me.mycrm.domain.dao.floggy.DAOImplFactory.initializeDB(DAOImplFactory.ja va:233) - sjs.me.mycrm.domain.dao.DataAccessObjectFactory.initializeDB(DataAccessObjec tFactory.java:224) - sjs.me.mycrm.ui.controller.Controller$1.doRun(Controller.java:263) - sjs.me.ui.controller.ProgressTarget.run(ProgressTarget.java:188) - java.lang.Thread.run(), bci=5 The persitable OrderBean has not changed structure. If I comment out the new index Floggy starts OK. For now, my 'migration' code just attempts to display what's going on: try { System.out.println("Checking for NotMigratedClasses..."); MigrationManager manager = MigrationManager.getInstance(); if (manager == null) System.out.println("ERROR: MigrationManager is NULL!"); else { String[] doMigrateClasses = manager.getNotMigratedClasses(); if (doMigrateClasses == null) System.out.println("\tNothing to migrate :-)"); else for (int i = 0; i < doMigrateClasses.length; i++) System.out.println("\tMigrate: " + doMigrateClasses[i]); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException(t.getMessage()); } How do you add indexes from one version to the next? For example, does this require backing up the store to file using native RMS - you can't 'touch' Floggy because the above exception occurs - dropping the store and related indexes, and then reloading it from file using Floggy? Or is there a simpler way? If I do need to backup and restore, what's the easiest and quickest way to backup the existing store? Thanks in advance for your help. Best regards, Jean-Marc Reynaud SuiteJ Solutions Ltd SuiteJ Solutions Ltd is registered in England and Wales with Company No. 07539075; VAT No. 159 6906 61. Disclaimer: The information contained in this document is intended for the named recipient only. It may contain privileged and confidential information. Unauthorised use or disclosure of it may be unlawful. Any opinions expressed are those of the individual and may not be official policy. If you are not the intended recipient you must not copy, distribute or take any action or rely on it without authority. If you receive this document in error please delete it and notify the sender immediately. Email is not a secure means of communication. SuiteJ Solutions Ltd monitors all email. Although this email and any attachments are believed to be free from any virus, it is the responsibility of the recipient to ensure that they are virus free. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com |