You need to use javax.persistence.Entity, not the Entity annotation
from Hibernate Annotations.  Hope that fixes the problem!

Matt

On 3/12/07, tonylu880042 <[EMAIL PROTECTED]> wrote:

Sure !! I follow the tutorial strictly.
here is my model,

package com.tcf.model;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.appfuse.model.BaseObject;
import org.hibernate.annotations.Entity;
@Entity
public class Person extends BaseObject {
        private Long id;
    private String firstName;
    private String lastName;
    @Column(name="first_name", length=50)
        public String getFirstName() {
                return firstName;
        }

        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }
        @Id @GeneratedValue(strategy = GenerationType.AUTO)
        public Long getId() {
                return id;
        }

        public void setId(Long id) {
                this.id = id;
        }
        @Column(name="last_name", length=50)
        public String getLastName() {
                return lastName;
        }

        public void setLastName(String lastName) {
                this.lastName = lastName;
        }

        @Override
        public boolean equals(Object o) {
                // TODO Auto-generated method stub
                return false;
        }

        @Override
        public int hashCode() {
                // TODO Auto-generated method stub
                return 0;
        }

        @Override
        public String toString() {
                // TODO Auto-generated method stub
                return null;
        }

}




mraible wrote:
>
> That certainly is strange - it all looks correct.  Do you have an
> @Entity annotation on your Person class?
>
> Matt
>
> On 3/12/07, tonylu880042 <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> tonylu880042 wrote:
>> >
>> >
>> > I used the basic archetypes.
>> > I checked the hibernate.cfg.xml for the Person class mapping. It was
>> > there.
>> > the package of the class is com.tcf.model.
>> > However, the table is still not created. Really upset  now.
>> >
>> > the output of mvn compile hibernate3:hbm2ddl
>> > ==============================
>> > C:\Projects\acmp>mvn compile hibernate3:hbm2ddl
>> > [INFO] Scanning for projects...
>> > [INFO] Searching repository for plugin with prefix: 'hibernate3'.
>> > [INFO]
>> >
>> ----------------------------------------------------------------------------
>> > [INFO] Building AppFuse Struts 2 Application
>> > [INFO]    task-segment: [compile, hibernate3:hbm2ddl]
>> > [INFO]
>> >
>> ----------------------------------------------------------------------------
>> > [INFO] [warpath:add-classes {execution: default}]
>> > [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
>> > [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
>> > [INFO] [resources:resources]
>> > [INFO] Using default encoding to copy filtered resources.
>> > [INFO] [compiler:compile]
>> > [INFO] Nothing to compile - all classes are up to date
>> > [INFO] Preparing hibernate3:hbm2ddl
>> > [WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive
>> > invocation.
>> > [INFO] [warpath:add-classes {execution: default}]
>> > [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
>> > [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
>> > [INFO] [resources:resources]
>> > [INFO] Using default encoding to copy filtered resources.
>> > [WARNING] POM for 'org.hibernate:jtidy:pom:r8-20060801:runtime' is
>> > invalid. It will be ignored for artifact resolution.
>> > Reason: Parse error reading POM. Reason: TEXT must be immediately
>> followed
>> > by END_TAG and not START_TAG (position: START
>> > _TAG seen ...<licenses>\n\t\t\t<license>... @12:13)
>> > [WARNING] POM for 'org.hibernate:jtidy:pom:r8-20060801:runtime' is
>> > invalid. It will be ignored for artifact resolution.
>> > Reason: Parse error reading POM. Reason: TEXT must be immediately
>> followed
>> > by END_TAG and not START_TAG (position: START
>> > _TAG seen ...<licenses>\n\t\t\t<license>... @12:13)
>> > [INFO] [hibernate3:hbm2ddl]
>> > [INFO] Configuration XML file loaded:
>> > C:\Projects\acmp\src\main\resources\hibernate.cfg.xml
>> > [INFO] Configuration XML file loaded:
>> > C:\Projects\acmp\src\main\resources\hibernate.cfg.xml
>> > [INFO] Configuration Properties file loaded:
>> > C:\Projects\acmp\target\classes\jdbc.properties
>> > alter table user_role drop foreign key FK143BF46AF503D155;
>> > alter table user_role drop foreign key FK143BF46A4FD90D75;
>> > drop table if exists app_user;
>> > drop table if exists role;
>> > drop table if exists user_role;
>> > create table app_user (id bigint not null auto_increment, username
>> > varchar(50) not null unique, email varchar(255) not n
>> > ull unique, first_name varchar(50) not null, last_name varchar(50) not
>> > null, password_hint varchar(255), phone_number va
>> > rchar(255), website varchar(255), account_expired bit not null,
>> > account_locked bit not null, credentials_expired bit not
>> >  null, city varchar(50) not null, province varchar(100), postal_code
>> > varchar(15) not null, address varchar(150), country
>> >  varchar(100), account_enabled bit, version integer, password
>> varchar(255)
>> > not null, primary key (id)) type=InnoDB;
>> > create table role (id bigint not null auto_increment, name varchar(20),
>> > description varchar(64), primary key (id)) type=
>> > InnoDB;
>> > create table user_role (user_id bigint not null, role_id bigint not
>> null,
>> > primary key (user_id, role_id)) type=InnoDB;
>> > alter table user_role add index FK143BF46AF503D155 (user_id), add
>> > constraint FK143BF46AF503D155 foreign key (user_id) re
>> > ferences app_user (id);
>> > alter table user_role add index FK143BF46A4FD90D75 (role_id), add
>> > constraint FK143BF46A4FD90D75 foreign key (role_id) re
>> > ferences role (id);
>> > [INFO]
>> >
>> ------------------------------------------------------------------------
>> > [INFO] BUILD SUCCESSFUL
>> > [INFO]
>> >
>> ------------------------------------------------------------------------
>> > [INFO] Total time: 12 seconds
>> > [INFO] Finished at: Tue Mar 13 08:30:31 CST 2007
>> > [INFO] Final Memory: 14M/26M
>> > [INFO]
>> >
>> ------------------------------------------------------------------------
>> > =====================================
>> > hibernate.cfg.xml
>> > <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
>> > Configuration DTD 3.0//EN"
>> >     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
>> >
>> > <hibernate-configuration>
>> >     <session-factory>
>> >               <mapping class="com.tcf.model.Person"/>
>> >         <mapping class="org.appfuse.model.User"/>
>> >         <mapping class="org.appfuse.model.Role"/>
>> >     </session-factory>
>> > </hibernate-configuration>
>> >
>> >
>> >
>> > tonylu880042 wrote:
>> >>
>> >> hi,
>> >>  I am new to appfuse 2.X .
>> >>  I follow the tutorials to create a Person table
>> >>  by using "mvn compile hibernate3:hbm2ddl" command
>> >>  However, the Person table not show up. It was just created
>> >>   User/Role tables.
>> >> Any suggestion will be appreciate.
>> >> Best regards
>> >> tony
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> 
http://www.nabble.com/Database-table-not-create--Newbie-Question-tf3383695s2369.html#a9446183
>> 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]
>
>
>

--
View this message in context: 
http://www.nabble.com/Database-table-not-create--Newbie-Question-tf3383695s2369.html#a9448221
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