Sorry all i found my mistake . I changed the hibernate.cfg.xml which is
located in target/classes package but the hibernate.cfg.xml file which is
under "myproject\src\main\resources" directory should be changed.

oguzhan tortop wrote:
> 
> Thanks by the way do you have any idea why it drops the old schema and
> creates again and deletes    person definition from hibernate config file
> and does not create the Person table ?
> 
> ros wrote:
>> 
>> Check sample-data.xml.
>> To create tables and fill data use 'mvn compile hibernate3:hbm2ddl
>> dbunit:operation'
>> 
>> 
>> oguzhan tortop wrote:
>>> 
>>> Hi all ,
>>> i lost previous data froum app_user , user_role and role tables when i
>>> try to create Person table which is described in the tutorials. Also it
>>> does not create Person table too and it deletes the line " <mapping
>>> class="com.mycompany.app.model.Person"/> " from hibernate.cfg.xml. What
>>> could be the problem also is there a way to load initial data of
>>> app_user , user_role and role tables ?
>>> ---------------*-----------*-*-------------------------------------------
>>> Here is my class :
>>> package com.mycompany.app.model;
>>> 
>>> import javax.persistence.Entity;
>>> import javax.persistence.GeneratedValue;
>>> import javax.persistence.GenerationType;
>>> import javax.persistence.Id;
>>> 
>>> import org.appfuse.model.BaseObject;   
>>> 
>>> @Entity 
>>> public class Person extends BaseObject {   
>>>     private Long id;   
>>>     private String firstName;   
>>>     private String 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;
>>>     }
>>>     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;
>>>     }
>>>     public String getLastName() {
>>>             return lastName;
>>>     }
>>>     public void setLastName(String lastName) {
>>>             this.lastName = lastName;
>>>     }   
>>>   
>>> 
>>> }  
>>> 
>>> ---------------*-----------*-*-------------------------------------------
>>> here is hibernate-config file
>>> <hibernate-configuration>
>>>     <session-factory>
>>>         <mapping class="org.appfuse.model.User"/>
>>>         <mapping class="org.appfuse.model.Role"/>
>>>         <mapping class="com.mycompany.app.model.Person"/> 
>>>     </session-factory>
>>> </hibernate-configuration>
>>> -----------*--------------*-*--------------------------------------------
>>> C:\myproject>mvn compile hibernate3:hbm2ddl
>>> [INFO] Scanning for projects...
>>> [INFO] Searching repository for plugin with prefix: 'hibernate3'.
>>> [INFO]
>>> -------------------------------------------------------------------------
>>> ---
>>> [INFO] Building AppFuse JSF 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] Compiling 1 source file to C:\myproject\target\classes
>>> [INFO] Preparing hibernate3:hbm2ddl
>>> [WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive
>>> invocati
>>> on.
>>> [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 w
>>> ill 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 w
>>> ill 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 w
>>> ill 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:\myproject\src\main\resources\hibernate.
>>> cfg.xml
>>> [INFO] Configuration XML file loaded:
>>> C:\myproject\src\main\resources\hibernate.
>>> cfg.xml
>>> [INFO] Configuration Properties file loaded:
>>> C:\myproject\target\classes\jdbc.pr
>>> operties
>>> 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, address
>>> varchar(150),
>>> country varchar(100), city varchar(50) not null, province varchar(100),
>>> postal_c
>>> ode varchar(15) not null, version integer, password varchar(255) not
>>> null, usern
>>> ame varchar(50) not null unique, account_enabled bit, email varchar(255)
>>> not nul
>>> l unique, password_hint varchar(255), first_name varchar(50) not null,
>>> last_name
>>>  varchar(50) not null, phone_number varchar(255), website varchar(255),
>>> account_
>>> expired bit not null, account_locked bit not null, credentials_expired
>>> bit not n
>>> ull, primary key (id)) type=InnoDB;
>>> create table role (id bigint not null auto_increment, name varchar(20),
>>> descript
>>> ion varchar(64), primary key (id)) type=InnoDB;
>>> create table user_role (user_id bigint not null, role_id bigint not
>>> null, primar
>>> y key (user_id, role_id)) type=InnoDB;
>>> alter table user_role add index FK143BF46AF503D155 (user_id), add
>>> constraint FK1
>>> 43BF46AF503D155 foreign key (user_id) references app_user (id);
>>> alter table user_role add index FK143BF46A4FD90D75 (role_id), add
>>> constraint FK1
>>> 43BF46A4FD90D75 foreign key (role_id) references role (id);
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] BUILD SUCCESSFUL
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] Total time: 1 minute 59 seconds
>>> [INFO] Finished at: Tue Mar 13 14:01:13 EET 2007
>>> [INFO] Final Memory: 14M/26M
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Creating-Database-Table-tf3395449s2369.html#a9453189
Sent from the AppFuse - User mailing list archive at Nabble.com.

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

Reply via email to