[{ALLOW view All}]
[{ALLOW edit Authenticated}]

!Eclipse (Old)

Installation on 16.10.2010
*Download Java EE 64bit Version
*Help > Install > Search "WTP" > Web Tools Platform (WTP) 3.2.2

!Version
see under Help > About Eclipse > Button "Eclipse.org":\\
{{{
Eclipse Helios SR1, Version 3.6.1.r361_v20100909
}}}

!JBoss Tools
As on 05.02.2011 only the nighly build works fine with Eclipse 3.6.1 + JBoss 6.\\
Search for nightly build [here|http://www.jboss.org/tools/download].
Then you need to add a repository like this to Eclipse
{{{
http://download.jboss.org/jbosstools/builds/nightly/trunk/2011-02-05_09-01-37-H1489/all/repo/
}}}
Install
* "JBossAS Tools"
* "JBoss Tools RichFaces"
This enables you to create a "JBoss 6.0 Runtime Server". (Current WTP Project just has JBoss 5)

!!Eclipse JSF2 + JPA2 Project
!JBoss 6.0 Runtime Server
1. Create a "JBoss 6.0 Runtime Server". This will show up in the "Servers" view.\\
2. In the "JBoss 6.0 Runtime Server" configuration (double click) there is a second tab "Deployment".\\
%%( margin-left: 20px; )Tick "Use a custom deploy folder" and use the real installation deploy folder both for "Deploy Directory" and "Temporary Deploy Directory".\\
%%( margin-left: 20px; )Otherwise the automatic deployment does not work properly.\\

!Projects
1. Create a JPA2 project\\
2. Create a JSF2 project, make the JPA2 a dependency in the build path\\
3. Create a EAR project to join both\\
4. Add the __EAR__ to the server to deploy (right click on server)\\

!Configure database connection to MySQL5
1. In the JPA project edit the persistence.xml:
{{{
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
	<persistence-unit name="DatePlanner201_JPA" transaction-type="JTA">
		<jta-data-source>java:/DatePlanner201_JPA</jta-data-source>
		<class>ebel.dp201.jpa.Profile</class>
		<properties>
			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
			<property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"/>
			<property name="hibernate.connection.url" value="jdbc:mysql://&lt;hostname&gt;/&lt;database&gt;"/>
			<property name="hibernate.default_schema" value="dp"/>
			<property name="hibernate.connection.username" value="user"/>
			<property name="hibernate.connection.password" value="xxx"/>
		</properties>
	</persistence-unit>
</persistence>
}}}
I had this in place already, but I guess you need to add a "Data Source Explorer" > "Database Connection" > dp.

2. In the http://localhost:8080/admin-console create a Datasources > Local Tx Datasources > 
{{{
JNDI Name *         = persistence-unit name = DatePlanner201_JPA (from above)
Username            = user
Password            = xxx
JDBC Driver Class * = com.mysql.jdbc.Driver
Connection URL *    = jdbc:mysql://localhost/dp (<hostname>/<database>)
}}}
__Note:__ You cannot edit (change) the configuration in the admin-console. Somehow the settings are not taken into the respective declaration file (!?).\\
%%( margin-left: 20px; )Better edit the file directly:
{{{
...\WebAppServer\jboss-6.0.0.Final\server\default\deploy\DatePlanner201_JPA-ds.xml
}}}


3. Put the driver to the server lib
{{{
...\WebAppServer\jboss-6.0.0.Final\server\default\lib\mysql-connector-java-5.1.7-bin.jar
}}}

4. Test\\
Use address to JSF project, e.g.\\
[http://localhost:8080/DatePlanner201_JSF]