I am developing a program with Hibernate and Oracle and I want to reproduce the same application using MySQL. I want to generate de database tables using:
We'll probably need a bit more information. Are you getting any errors?
If you can do one, then try to do just two. See if you can get two to work. Maybe even scale it back to table name and primary key for two tables. Then incrementally do more until you find the setting that might be causing the problem.
Just an approach. Any errors? Bizarre table mappings? I'm betting the three tables are dependent on each other?
Thank you for the answer. I followed the instructions and It helped to locate the problem. Oracle allowed me to use the word "KEY" as a field name and MySQL did not like it, so I guess "KEY" is a reserved keyword in MySQL. So I changed the field name and now it works.
from:
@Length(max=80)
@Column(name="KEY", length=80)
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
to:
@Length(max=80)
@Column(name="PKEY", length=80)
public String getPkey() {
return pkey;
}
public void setPkey(String pkey) {
this.pkey = pkey;
}
now it works, so great. Thank you for the quick help.
M. Marin.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Good sleuthing, Greenhorn! And thanks for the post-back. You'll be surprised by how many people will have that exact problem and have it subsequently solved by your hard work.
I know a guy that wrote an entire book using a table named "User" and a MySQL database, only to discover none of the examples worked as promised in certain databases because User is a reserved word. What a drag!
I am developing a program with Hibernate and Oracle and I want to reproduce the same application using MySQL. I want to generate the database tables using:
from the ("Oracle") domain code, but I can only create one table out of four. Does anyone have an idea what I am doing wrong?
Regards.
M. Marin.
Hi,
can you please post your bean class and persistence.xml and the settings what you are using to execute this program..because I am facing the same problem and struggling for one week to create tables in database automatically.
Thanks in Advance,
Best Regards,
Raja.
M Marin
Ranch Hand
Joined: Feb 20, 2010
Posts: 32
posted
0
I am not using persistance.xml for the project. I use hibernate.cfg.xml:
10:24:07,528 INFO [SchemaUpdate] updating schema
10:24:07,528 INFO [SchemaUpdate] schema update complete
Looks like its updating the schema.
(NB: "entity beans" are a EJB2 technology. When you say you created entity beans did you really mean entity beans? )
hi, this is my class..can you please check it..
rajasekhar kannamaneni
Greenhorn
Joined: Nov 05, 2010
Posts: 27
posted
0
M Marin wrote:Add also the schema name manually to de database, just leave the tables to be automatically generated.
what I found one interesting fact is..when jboss runs persistence.xml its not generating any create table queries..thats why its not creating any tables..how to generate the create table queries automatically.