Jump to content
McObject Forums


Root Admin
  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About perstmco

  • Rank

Profile Information

  • Gender

Recent Profile Visitors

19,976 profile views
  1. My delete does not work

    1. You should exclude objects from index(es) prior to deallocation it. I do not think that it will really cause a problem in your case, but in any case it is reasonable to exclude objects from indexes before deallocating them. 2. Deallocation of objects is done in many Perst examples. You can look at TestAlloc.java, for example. 3. It is not clear from your code what is the original size of the database and how many objects are actually deleted by deleteFahrt. If it deletes just a few objects that have a total size of less than one page, then the size of database after compactification could be the same as the original database.
  2. My delete does not work

    Excluding objects from index doesn't cause deallocation of object instances themselves. You must explicitly call Deallocate() method for each object or use ITable.DeallocateMembers method.
  3. My delete does not work

    You need to commit the current transaction to persist your changes and make them visible in backup.
  4. My delete does not work

    After the backup, did you delete the original database file and rename the backup to the name of the original file?
  5. Query 3+ values against one index

    Yes, of course.
  6. My delete does not work

    What are we looking for in your code?
  7. My delete does not work

    No, you should perform backup to some other file and then you can rename it to original file.
  8. My delete does not work

    It is Storage.backup method: /** * Backup current state of database * @param out output stream to which backup is done */ public void backup(java.io.OutputStream out) throws java.io.IOException; /** * Backup current state of database to the file with specified path * @param filePath path to the backup file * @param cipherKey cipher key for the encryption oof the backup file, null to disable encryption */ public void backup(String filePath, String cipherKey) throws java.io.IOException; It performs backup of the storage file and defragment it at the same time.
  9. Query 3+ values against one index

    Apply the following patch to database.cs, rebuild Perst, and it should fix the problem: Index: src/Database.cs =================================================================== --- src/Database.cs (revision 15853) +++ src/Database.cs (working copy) @@ -1827,23 +1827,23 @@ } if (expr.NodeType == ExpressionType.OrElse) { - if (left.NodeType == ExpressionType.Equal && IsLiteral(((BinaryExpression)left).Right, out value)) + if (right.NodeType == ExpressionType.Equal && IsLiteral(((BinaryExpression)right).Right, out value)) { - Expression baseExpr = ((BinaryExpression)left).Left; + Expression baseExpr = ((BinaryExpression)right).Left; alternatives = new ArrayList(); - while (right is BinaryExpression) + while (left is BinaryExpression) { Expression cmp; - if (right.NodeType == ExpressionType.OrElse) + if (left.NodeType == ExpressionType.OrElse) { - BinaryExpression or = (BinaryExpression)right; - right = or.Right; - cmp = or.Left; + BinaryExpression or = (BinaryExpression)left; + left = or.Left; + cmp = or.Right; } else { - cmp = right; - right = null; + cmp = left; + left = null; } if (cmp.NodeType != ExpressionType.Equal || !EqualExpressions(baseExpr, ((BinaryExpression)cmp).Left) @@ -1853,11 +1853,11 @@ } alternatives.Add(value); } - if (right != null) + if (left != null) { return null; } - expr = left; + expr = right; left = ((BinaryExpression)expr).Left; right = ((BinaryExpression)expr).Right; }
  10. My delete does not work

    Perst never shrinks the size of a database. It just marks deallocated objects as free. This space will be reused by new allocation requests. This space is not returned to the file system, so you will not see extra free space after the end of a bulk delete. You can use the compactify method to shrink the database.
  11. getObjectby StrKey

    Mikkel, is this case resolved?
  12. org.garret.perst.AssertionFailed: Assertion failed

    To be able to instantiate a persistent object (when it is loaded from the storage) Perst requires persistent classes to have a default constructor (a constructor without parameters). But, this is only the case if you are not using Sun's (Oracle) JVM. In the case of standard JDK, Perst can use an unsafe non-public API, allowing to instantiate objects without a public constructor.
  13. getObjectby StrKey

    Sure, try it. Let us know if you have problems.
  14. getObjectby StrKey

    >> Is there a Way to set the objectid to the value of strKey or something else to get exactly the object with the strKey value "xyz" for example? Something like this: Fahrt fahrt = root.foreignIndex.dataKeyIndex .get("xyz");
  15. getObjectby StrKey

    Sorry, we do not completely understand the question. Which API you using? Perst provides a large number of various indexes and these indexes provide various access methods. If you just need to get an object by a unique key, then you can use get(Object key) method. Otherwise, show us a class definition and explain how you want to access objects of this class and we can advise further.