Package org.apache.ojb.broker.util

Examples of org.apache.ojb.broker.util.ObjectModificationDefaultImpl


   * Test creating two objects with the same ID, should fail with
   * key constraint error
   **/
  public void testKeyViolation() throws Exception
  {
        ObjectModificationDefaultImpl objMod = new ObjectModificationDefaultImpl();
        objMod.setNeedsInsert(true);

        broker.beginTransaction();
        Article obj = new Article();
        obj.setProductGroupId(1);
        obj.articleName = "repeated Article";
View Full Code Here


     * Insert the method's description here.
     * Creation date: (06.12.2000 21:51:22)
     */
    public void testUpdateWithModification() throws Exception
    {
        ObjectModificationDefaultImpl modification = new ObjectModificationDefaultImpl();
        assertTrue("should not be marked for update yet", !modification.needsUpdate());
        assertTrue("should not be marked for insert", !modification.needsInsert());
        Article a = createArticle(testId);
        storeArticle(a);
        Article b = readArticleByIdentity(testId);
        assertEquals(
                "after inserting an object it should be equal to its re-read pendant",
                a.getArticleName(),
                b.getArticleName());
        String newname = "TESTUPDATE";
        b.setArticleName(newname);
        modification.markModified();
        assertTrue("should be marked for update", modification.needsUpdate());
        assertTrue("should not be marked for insert", !modification.needsInsert());
        broker.beginTransaction();
        broker.store(b, modification);
        broker.commitTransaction();

        b = null;
View Full Code Here

        }

        protected void insertNewArticles() throws Exception
        {

            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
            needsInsert.setNeedsInsert(true);

            long start = System.currentTimeMillis();

            for (int i = 0; i < arr.length; i++)
            {
View Full Code Here

        }

        protected void insertNewFarAways() throws Exception
        {

            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
            needsInsert.setNeedsInsert(true);

            long start = System.currentTimeMillis();

            for (int i = 0; i < arr.length; i++)
            {
View Full Code Here

        }

        protected void insertNewArticles() throws Exception
        {

            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
            needsInsert.setNeedsInsert(true);

            long start = System.currentTimeMillis();

            for (int i = 0; i < arr.length; i++)
            {
View Full Code Here

   * Test creating two objects with the same ID, should fail with
   * key constraint error
   **/
  public void testKeyViolation() throws Exception
  {
        ObjectModificationDefaultImpl objMod = new ObjectModificationDefaultImpl();
        objMod.setNeedsInsert(true);

        broker.beginTransaction();
        Article obj = new Article();
        obj.setProductGroupId(new Integer(1));
        obj.articleName = "repeated Article";
View Full Code Here

         * A performance optimized insert-method implementation,
         * used to test performance.
         */
        public void insertNewArticles(PerfArticle[] arr) throws Exception
        {
            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl(true, false);
            PersistenceBroker broker = null;
            try
            {
                broker = PersistenceBrokerFactory.defaultPersistenceBroker();
                broker.serviceConnectionManager().setBatchMode(true);
View Full Code Here

            return col;
        }

        public void updateArticles(PerfArticle[] arr) throws Exception
        {
            ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl(false, true);
            PersistenceBroker broker = null;
            try
            {
                broker = PersistenceBrokerFactory.defaultPersistenceBroker();
                broker.serviceConnectionManager().setBatchMode(true);
View Full Code Here

     * create new PerformanceArticle objects and insert them into the RDBMS.
     * The number of objects to create is defined by <code>articleCount</code>.
     */
    protected void insertNewArticles() throws PersistenceBrokerException
    {
        ObjectModificationDefaultImpl needsInsert = new ObjectModificationDefaultImpl();
        needsInsert.setNeedsInsert(true);

        long start = System.currentTimeMillis();
        broker.beginTransaction();
        for (int i = 0; i < articleCount; i++)
        {
View Full Code Here

        {
            arr[i].setPrice(arr[i].getPrice() * 1.95583);
        }

        // build mod object that tell OJB to use UPDATE
        ObjectModificationDefaultImpl needsUpdate = new ObjectModificationDefaultImpl();
        needsUpdate.setNeedsUpdate(true);

        long start = System.currentTimeMillis();
        broker.beginTransaction();
        for (int i = 0; i < articleCount; i++)
        {
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.util.ObjectModificationDefaultImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.