Skip to main content

Posts

Showing posts from October, 2009

JavaEE 5 (JSF + JPA + EJB3) using Eclipse

Today I will show you how to create Enterprise Application using Java EE 5 and GlassFish. I will use - Eclipse 3.5 + WTP - GlassFish v. 2.1 - JSF Mojarra implementation. - EJB 3.0. - JPA Toplink essentials implementation. - MySQL No NetBeans or JDeveloper magic involved :) The prerequirement is: Add datasource in glassfish. Read this how you can make this here: http://gochev.blogspot.com/2009/10/creating-datasource-in-glassfish-v-21.html 1) First you need to add glassfish in your eclipse. - Go to Servers View - Right Click, New - Choose GlassFish v 2.1 if you dont have glassfish click on Download additional adapters link choose glassfish wait and restart eclipse. Than try again. 2) Create the database CREATE TABLE ` lesson ` . ` USERS ` ( ` id ` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, ` username ` VARCHAR ( 45 ) NOT NULL , ` password ` VARCHAR ( 45 ) NOT NULL , ` name ` VARCHAR ( 45 ) NOT NULL , PRIMARY KEY ( ` id ` ) ) ENGINE = InnoDB

Creating DataSource in GlassFish v. 2.1

I will show you how to create a DataSource in GlassFish version 2.1 because there were a lot of properties and I had a lot of problems when I've try to register datasource in glassfish for the first time. 1) You have to download JDBC driver for your database. For example I will use MySQL and I will use Connector/J driver that you can download from mysql official web site. 2) Place the JDBC driver in for example D:\glassfishv21\domains\domain1\lib\ext for example my driver is mysql-connector-java-5.0.4.jar 3) Start the domain for example domain1 (asadmin start-domain domain1) 4) go to http://localhost:4848 and login as admin. By default the username is 'admin' and the password is 'adminadmin' 5) go to Resources/JDBC/Connection Pools -First we will create a connection pool. Click the 'NEW' button -Than you must type: - Name: of the connection pool for example MySQL Lessson - Resource Type: javax.sql.ConnectionPoolDataSource - Database Vendor:

About Me

Superhero with Java powers && Gamer && (Sci-Fi & Star Wars geek) && Bulgarian Java User Group Fellow Leader && nerds2nerds podcaster && (link: http://java.beer) java.beer guy ? this : null  I believe the above is enough, isn't it ? Anyway if you one of this... well...  non developers ? or HRs or recruiters or something in between ... you can check even my CV  here .