-
1. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Feb 22, 2010 1:24 PM (in response to salimoflaz)New Seam Entity wizard uses templates from Seam Gen it doesn't based on information from your database. You probably should start from 'Seam Generate Entities' Wizard to generated entities based on your database schema.
-
2. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
salimoflaz Feb 23, 2010 3:43 AM (in response to dgolovin)Hi Denis,
Thank you for your reply. I already tried seam generate entities, but it didn't work also. I am using HSQL database in single user mode. It didn't do anything. Some debug messages to console is printed from hibernate code generation facility such as cannot find any columns and cannot find primary key. I guess it's due to naming of database objects such as schema name and table names. Do you have any experience with code generation facility with HSQL database? I am thinking of migrating my db to mySQL. Do you have any opininon? Or should I post a new thread for this question? Thanks,
Best Regards,
Salim OFLAZ
-
3. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
maxandersen Feb 23, 2010 8:56 AM (in response to salimoflaz)hsql works fine - its actully the db we use for most of our tests for reverse engineering.
Any chance you got a "funny" schema or somehow misspelled the schema or catalog names ?
-
4. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Feb 23, 2010 1:53 PM (in response to salimoflaz)How did you configure your HSQL database in Eclipse? I remember there were several tricks to get it works, I'll check it and post details here.
You can look at screen cast "Connecting to database and reverse engineering" in case you're going to use MySQL.
-
5. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Feb 25, 2010 4:54 PM (in response to salimoflaz)1 of 1 people found this helpfulYou have several options to start HSQL. I would chouse from couple described below:
1. In process - by pointing out to local folder during creating DTP Connection Profile
2. Server - by starting it outside eclipse using command line and then create DTP Connection Profile with local server
In Process Option
If you use "in process" option you have to be aware that it is not enough just point out folder where your database is located in connection properties. You have to add one more segment to it with database name or your DB will be empty (see explanation below).
For example you have HSQL DB somewhere on disk with name "employee". Im my case I have it downloaded from here and just moved all files to local directory /home/eskimo/db/employee. So I have in this folder structure showed below (ignore employee.lck file it will be created after first "In process" start and not needed initially)
I assume you you have the same but you need to correct all paths "/home/eskimo/db/employee" and database name "employee" with yours real values.
Then create "Database Connection" in DTP "Data Source Explorer" View by selecting "New..." from context menu on "Database Connections" node like
Then select "HSQLDB" connection type and enter DB name as "employee"
Then I assume you already have configured HSQL JDBC Driver and all what you need to is enter database name again as "employee" and select its location. After that one magic step is needed (it could be DTP issue). Add one more segment in "Database Location" like "/employee" like it shown below. Do not forget clear "Connect when wizard completes" checkbox because it will start In Process HSQL after wizard is finished and create employee.lck file in your database folder. This file will be the reason Seam why Seam Entity Generation wizard will fail during execution.
Press Finish and check that employee node created under "Database Connections".
Now you're ready to create Seam Web project using "New Seam Web Project" wizard like it shown below (it shows only first and last steps because all other steps I left unchanged with default values).
Then comes screens I left unchanged and finally you get to last one with seam configuration. You should have seam 2.1 configured and all what you need is to fill Database properties like it shown below and press "Finish".
After wizard is finished you should see two projects prj1 and prj1-test in your workspace. Now to be ready for entities reverse engineering from your database you need to be sure hsqldb.jar is available in your Server classpath container or in prj1/WebContent/WEB-INF/lib folder. If you don't have hsqldb.jar there "Generate Seam Entities" will fail with ClassNotFound Exception, because it will not be able to find HSQL JDBC driver class.
Now you're ready to go. Switch to Seam Perspective and select "Generate Seam Entiies" from context menu on prj1 project
Leave first step unchanged like it shown below and press "Next"
On second step press "Refresh" button and make sure it shows all tables form database as it shown below. If there are no tables most likely HSQL connection is not correctly configured. To generate Seam Entities and xhtml pages press "Finish".
You should get bunch of generated classes in source folder and pages in WebContent.
Server Option
You need to start HSQL as Server first using command line. Open console and change your directory to database directory like
$ cd /home/eskimo/db/employee
Then start HSQL server in Server Mode like
$java -cp /home/eskimo/Java/hsqldb/lib/hsqldb.jar org.hsqldb.Server
You should see output like
[Server@19106c7]: [Thread[main,5,main]]: checkRunning(false) entered [Server@19106c7]: [Thread[main,5,main]]: checkRunning(false) exited [Server@19106c7]: Startup sequence initiated from main() method [Server@19106c7]: Loaded properties from [/home/eskimo/db/employee/server.properties] [Server@19106c7]: Initiating startup sequence... [Server@19106c7]: Server socket opened successfully in 8 ms. [Server@19106c7]: Database [index=0, id=0, db=file:employee, alias=] opened sucessfully in 690 ms. [Server@19106c7]: Startup sequence completed in 699 ms. [Server@19106c7]: 2010-02-25 13:37:54.016 HSQLDB server 1.8.1 is online [Server@19106c7]: To close normally, connect and execute SHUTDOWN SQL [Server@19106c7]: From command line, use [Ctrl]+[C] to abort abruptly
It starts by default in silent mode. If you want to see what's going one just change property server.silent in server.properties file from true to false and your output will look like
[Server@34a1fc]: [Thread[main,5,main]]: checkRunning(false) entered [Server@34a1fc]: [Thread[main,5,main]]: checkRunning(false) exited [Server@34a1fc]: Startup sequence initiated from main() method [Server@34a1fc]: Loaded properties from [/home/eskimo/db/employee/server.properties] [Server@34a1fc]: [Thread[main,5,main]]: start() entered [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: run() entered [Server@34a1fc]: Initiating startup sequence... [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.tls=false [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.port=1701 [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.trace=false [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.database.0=employee [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.restart_on_shutdown=false [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.no_system_exit=false [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.silent=false [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.default_page=index.html [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.address=0.0.0.0 [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.dbname.0= [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: server.root=. [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: openServerSocket() entered [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: Got server socket: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=1701] [Server@34a1fc]: Server socket opened successfully in 4 ms. [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: openServerSocket() exiting [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: openDatabases() entered [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: Opening database: [file:employee] [Server@34a1fc]: Database [index=0, id=0, db=file:employee, alias=] opened sucessfully in 696 ms. [Server@34a1fc]: [Thread[HSQLDB Server @34a1fc,5,main]]: openDatabases() exiting [Server@34a1fc]: Startup sequence completed in 701 ms. [Server@34a1fc]: 2010-02-25 13:41:49.516 HSQLDB server 1.8.1 is online [Server@34a1fc]: To close normally, connect and execute SHUTDOWN SQL [Server@34a1fc]: From command line, use [Ctrl]+[C] to abort abruptly [Server@34a1fc]: [Thread[main,5,main]]: start() exiting
Starting HSQL as Servers you should not worry about employee.lck anymore and can leave "Connect when wizard completes" checkbox selected during creating new HSQL Database Connection, but Database Location should be changed to hsql://localhost:1701 in second step of "New Database Connection" Wizard like
-
6. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
salimoflaz Feb 26, 2010 1:08 PM (in response to dgolovin)Thanks Denis,
I appreciate.
Best Regards,
Salim OFLAZ
-
7. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
salimoflaz Mar 1, 2010 8:31 AM (in response to dgolovin)Hi Dennis,
I finally achieved to generate some files with Jboss Tools in eclipse. I read the database user guide you mentioned in your post and added some parameters to the command used to start database in server mode. like this one;
java -cp ~/lib/hsqldb/lib/hsqldb.jar org.hsqldb.Server -database.0 file:test -dbname.0 ta
to give database alias and pyhsical files used for it.
I am using Open SUSE 10.3 LINUX operating system and eclipse ganymede 3.4.2 and Jboss Tools 3.0.3 GA and I discovered that the database table names should be in uppercase, maybe this holds for other database objects such as Foreign Keys, Primary Keys and Views. Otherwise it's not generating anything.
In addition I had to switch to Hibernate perspective and changed Hibernate configuration such as database connection and dialect, added hsqldb.jar to classpath, changed type to core.
After all it worked. But I spent a lot of time. Hope this helps somebody else in the future who plan to use HSQLDB and Jboss Tools.
Thank you for your posts.
Best Regards,
Salim OFLAZ
-
8. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Mar 1, 2010 8:20 PM (in response to salimoflaz)You're welcome
How do you create tables in your HSQL database? I tried several ways to create table in HSQL and it always created with CAPITALIZED name.salimoflaz wrote:
I discovered that the database table names should be in uppercase, maybe this holds for other database objects such as Foreign Keys, Primary Keys and Views. Otherwise it's not generating anything.
-
9. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
salimoflaz Mar 1, 2010 11:40 PM (in response to dgolovin)with standard sql. I couldn't find a front-end for hsql database. -
10. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Mar 2, 2010 3:06 PM (in response to salimoflaz)1 of 1 people found this helpfulYou can do it from Eclipse if you have DTP installed:
1. Switch to "Database Development" perspective select bar menu "Window->Open Perspective->Other..." and then select "Database Development" in list and press "Ok".
2. Find your connection profile in "Data Source Explorer" view and expand your HSQL connection profile till Tables node
3. Look into pop-up menus for "Tables" and table nodes. You can:
- Create new table
- Load, view and edit data in tables
- Delete tables
- Generate DDL
Is that an acceptable front-end?
If you don't have Eclipse you can use HSQL Database Manager. To start it use command line like command below (it assumes you are in root folder of your hsql installation)
java -cp lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing -url jdbc:hsqldb:hsql://localhost:1701/ -driver org.hsqldb.jdbcDriver
You should see something like on screen-shot below
We might have a different version of HSQL, mine is 1.8.1.1. With all those tools above I couldn't create table with lower case name.
-
11. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
salimoflaz Mar 2, 2010 3:36 PM (in response to dgolovin)Denis,
I tried using DTP interface at the beginning, I was able to create tables, edit,load data and so on. But my changes were lost after I close Eclipse, that means all my work had gone. So I decided not to use that interface and I don't know why. Nowadays I guess it was because the db was in memory mode, it was an in-process connection, and somehow my changes were lost. Today I tried to use hibernate schema export tool and it's very helpful, I had to learn some hibernate syntax of some configuration files, but it does worth. With the HSQLDatabase manager you still have to type SQL DDL, I guess, in fact it was not very helpful. Three years ago I was using eclipse with some IBM plugins and there was a beatiful graphical database design tool. I was not able to find any equivalents, I tried to install EMF package, but it does not install anything helpful in designing databases. And I would like to install some graphical design tools for UML, but I don't know how to address these installations. I couldn't find anything other than EMF. It was a huge package but I was not able to get Modelling Perspective in Eclipse Ganymede 3.4.2. Thanks for your Helpful answers.
Best Regards,
Salim OFLAZ
-
12. Re: JBossTools-3.0.3.GA On Eclipse Ganymede
dgolovin Mar 2, 2010 4:02 PM (in response to salimoflaz)Salim,
you're right about loosing your work using in-process connection, in server mode there should be no issues like this.
Thank you for sharing your opinion about JBoss Tools features and other Eclipse tools you deal in your development proces, we're working to make them better