Package org.apache.torque.test.dbobject

Examples of org.apache.torque.test.dbobject.Author.save()


        author.setName(null); // is required

        // execute & verify
        try
        {
            author.save();
            fail("Exception expected");
        }
        catch (ConstraintViolationException e)
        {
            assertTrue(e.getCause() instanceof SQLException);
View Full Code Here


            {
                fail("autocommit must be set to false for this test");
            }
            Author author1 = bookstoreContent.get(0);
            author1.setName("new Author1");
            author1.save(transaction1);

            // lock author 2 in transaction 2
            transaction2 = Transaction.begin();
            if (transaction2.getAutoCommit())
            {
View Full Code Here

            {
                fail("autocommit must be set to false for this test(2)");
            }
            Author author2 = bookstoreContent.get(1);
            author2.setName("new Author2");
            author2.save(transaction2);

            // lock author 2 in transaction 1 (must wait for lock)
            author2.setName("newer Author2");
            SaveAndRollbackThread saveThreadTransaction1
                = new SaveAndRollbackThread(
View Full Code Here

        // Create some test data
        for (int i = 0; i < TEST_ROWS; i++)
        {
            Author author = new Author();
            author.setName(LARGE_SELECT_AUTHOR);
            author.save();
            if (-1 == firstAuthorId)
            {
                firstAuthorId = author.getAuthorId();
            }
        }
View Full Code Here

    protected void insertTestData() throws TorqueException
    {
        // insert test data
        Author author = new Author();
        author.setName("Author with one book");
        author.save();
        Book book = new Book();
        book.setAuthor(author);
        book.setTitle("Book 1");
        book.setIsbn("unknown");
        book.save();
View Full Code Here

        book.setIsbn("unknown");
        book.save();

        author = new Author();
        author.setName("Author without book");
        author.save();

        author = new Author();
        author.setName("Author with three books");
        author.save();
        for (int bookNr = 2; bookNr <=4; bookNr++)
View Full Code Here

        author.setName("Author without book");
        author.save();

        author = new Author();
        author.setName("Author with three books");
        author.save();
        for (int bookNr = 2; bookNr <=4; bookNr++)
        {
            book = new Book();
            book.setAuthor(author);
            book.setTitle("Book " + bookNr);
View Full Code Here

     */
    public void testCopyObject() throws Exception
    {
        Author author = new Author();
        author.setName("Author to be copied");
        author.save();

        for (int j = 1; j <= 10; j++)
        {
            Book book = new Book();
            book.setAuthor(author);
View Full Code Here

        AuthorManager.getManager().setRegion("om_Author");
        BookManager.getManager().setRegion("om_Book");

        Author author1 = new Author();
        author1.setName("author1");
        author1.save();
        Author author2 = new Author();
        author2.setName("author2");
        author2.save();

        Author myauthor = AuthorManager.getCachedInstance(author1.getPrimaryKey());
View Full Code Here

        Author author1 = new Author();
        author1.setName("author1");
        author1.save();
        Author author2 = new Author();
        author2.setName("author2");
        author2.save();

        Author myauthor = AuthorManager.getCachedInstance(author1.getPrimaryKey());
        assertNotNull("Primary key of Author1 should not be null", author1.getPrimaryKey());
        assertNotNull("MyAuthor should not be null", myauthor);
        assertTrue("Author1 and MyAuthor should point to the same cache instance", author1 == myauthor);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.