Did you modify your sample-data.xml to have a sample record? You need
to do that, or manually add a Person to the database in your test.

Matt

On 7/9/07, Vishal S <[EMAIL PROTECTED]> wrote:


Hello friends,

  JDK 1.5
  Ant 1.6.5
  Appfuse JSF 1.9.4

   While following the quick start tutorial on creating Person details I am
getting the following
error.

    [junit] Testcase: testSavePerson(org.dcbooks.dao.PersonDaoTest):    Caused
an ERROR
    [junit] Object of class [org.dcbooks.model.Person] with identifier [1]:
not found

    Person.hbm.xml are there in the following directory.

    E:\dcbooks\build\dao\gen\org\dcbooks\model

    Error details and Person.hbm.xml has been included at the bottom.

    Please help.

    Thank you.

Vishal S


***********************************
Error Details
***********************************

Buildfile: build.xml

init:

prepare:
     [echo] Preparing target directory 'E:\dcbooks/build/dcbooks'

copy-resources:
     [copy] Copying 15 files to E:\dcbooks\build\web\classes
[native2ascii] Converting 2 files from E:\dcbooks\web\WEB-INF\classes to
E:\dcbooks\build\web\classes
[native2ascii] Converting 5 files from E:\dcbooks\web\WEB-INF\classes to
E:\dcbooks\build\web\classes
     [echo] generating database.properties from build.properties
[propertyfile] Updating property file: E:\dcbooks\database.properties
     [copy] Copying 1 file to E:\dcbooks\build\web\classes

hibernatedoclet:
[hibernatedoclet] Jul 10, 2007 12:01:22 AM xdoclet.XDocletMain start
[hibernatedoclet] INFO: Running <hibernate/>

compile-dao:
     [echo] Compiling dao...

package-dao:
     [copy] Copying 1 file to E:\dcbooks\build\dao\gen\META-INF
      [jar] Building jar: E:\dcbooks\dist\dcbooks-dao.jar

db-load:
   [dbunit] Executing operation: CLEAN_INSERT
   [dbunit]           on   file: E:\dcbooks\metadata\sql\sample-data.xml
   [dbunit]           with format: xml

with-debug:

no-debug:

check-debug:

test-dao:
     [echo] Testing dao...
    [mkdir] Created dir: E:\dcbooks\build\test\data
     [copy] Copying 1 file to E:\dcbooks\build\test\dao\classes
    [junit] [dcbooks] INFO [main] PersonDaoTest.loadContextLocations(136) |
Loading context for:
classpath*:/**/dao/applicationContext-*.xml,classpath*:META-INF/applicationContext-*.xml
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] DEBUG [main] PersonDaoTest.testAddAndRemovePerson(58)
| removing person...
    [junit] [dcbooks] DEBUG [main] PersonDaoTest.testAddAndRemovePerson(70)
| Expected exception: Object of class [org.dcbooks.model.Person] with
identifier [2]: not found
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] Testsuite: org.dcbooks.dao.PersonDaoTest
    [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 2.328 sec

    [junit] ------------- Standard Output ---------------
    [junit] [dcbooks] INFO [main] PersonDaoTest.loadContextLocations(136) |
Loading context for:
classpath*:/**/dao/applicationContext-*.xml,classpath*:META-INF/applicationContext-*.xml
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] [dcbooks] INFO [main] PersonDaoTest.startNewTransaction(309) |
Began transaction (1): transaction manager
[EMAIL PROTECTED];
default rollback = true
    [junit] [dcbooks] DEBUG [main] PersonDaoTest.testAddAndRemovePerson(58)
| removing person...
    [junit] [dcbooks] DEBUG [main] PersonDaoTest.testAddAndRemovePerson(70)
| Expected exception: Object of class [org.dcbooks.model.Person] with
identifier [2]: not found
    [junit] [dcbooks] INFO [main] PersonDaoTest.endTransaction(275) | Rolled
back transaction after test execution
    [junit] ------------- ---------------- ---------------
    [junit] Testcase: testSavePerson(org.dcbooks.dao.PersonDaoTest):    Caused
an ERROR
    [junit] Object of class [org.dcbooks.model.Person] with identifier [1]:
not found
    [junit] org.springframework.orm.ObjectRetrievalFailureException: Object
of class [org.dcbooks.model.Person] with identifier [1]: not found
    [junit]     at
org.dcbooks.dao.hibernate.PersonDaoHibernate.getPerson(PersonDaoHibernate.java:14)
    [junit]     at
org.dcbooks.dao.PersonDaoTest.testSavePerson(PersonDaoTest.java:31)
    [junit]     at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)


*********************************** End of Error Details





***********************************
Person.hbm.xml
***********************************
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>

<hibernate-mapping

>

    <class
            name="org.dcbooks.model.Person"
            table="person"
    >

    <id
        name="id"
            column="id"
            unsaved-value="null"
    >

    <!-- The generator-class attribute of @hibernate.id is deprecated, use
the @hibernate.generator tag instead -->
    <generator class="native">

    </generator>

    </id>

        <property
            name="firstName"
                    column="first_name"
                length="50"
                not-null="true"
        >

        </property>

        <property
            name="lastName"
                    column="last_name"
                length="50"
                not-null="true"
        >

        </property>

    </class>

</hibernate-mapping>




--
View this message in context: 
http://www.nabble.com/Error-while-executing-ant-test-dao--Dtestcase%3DPersonDao-tf4051186s2369.html#a11507436
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to