Basic JSF 2.0 Maven Configuration (with Eclipse and Tomcat 7.0)

September 12, 2011 Leave a comment

I’ve decided to learn JSF 2 to upgrade my knowledge of JSF. I would have searched for a JSF 2 Maven archetype but I wanted to learn how to configure it myself so here’s a basic hello world application (I’m assuming that you have a basic knowledge of Maven, if not please go here).

Read more…

Use the New JDBC Driver for MS SQL Server

August 16, 2009 8 comments

I’ve used MySQL with my example on my Hibernate posts but since we are using MS SQL Server 2000 in my class(I know, we should be upgrading to at least SQL Server 2005…) I thought I’d create an example using SQL Server.

So there I was reconstructing everything that I mentioned starting with Java Persistence with Hibernate Part 2 – Getting Started until I was done with my test class to see if everything works and that’s what I was expecting but I was wrong. Instead I got this error:

Exception in thread "main" java.lang.AbstractMethodError: com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z

Read more…

Java Persistence with Hibernate Part 4 – Create the Mapping File and Configuration File

August 15, 2009 Leave a comment

We need to tell Hibernate how our persistent class(Student.java) maps to our table(student_table) for Hibernate to be able to load and persist(save) data.

Create the Mapping File

The basic structure of a mapping file is like this:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate -mapping package="com.phoenixone.hibernate.model">
	<class name="com.tutorial.enrollment.model.Student" table="student">
		<id name="id" column="student_id">
			<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator" />
		</id>
		<property name="firstName" column="first_name" />
		<property name="lastName" column="last_name" />
	</class>
</hibernate>

Read more…

Java Persistence with Hibernate Part 3 – Create the Database and Persistent Class

August 14, 2009 1 comment

Create a Database

In using Hibernate you may either create the database first and create the class we need to persist or vice-versa.

create database enrollment;
create table student(
 student_id int,
 first_name varchar(40),
 last_name varchar(40),
 primary key(student_id)
);

With the SQL code above, we’ve created a database named “enrollment” and a table named “student” with three columns(student_id, first_name and last_name) with student_id as our primary key(unique identifier).
Read more…

Java Persistence with Hibernate Part 2 – Getting Started

August 14, 2009 Leave a comment

In Java Persistence with Hibernate Part 1 I’ve discussed the need for object/relational persistence and some things that Hibernate aims to answer.

Hibernate has several modules which answer specific problems. The two most important modules to learn are Hibernate Core and Hibernate Annotations.
Read more…

Java Persistence With Hibernate Part 1

August 12, 2009 2 comments

Okay, first up on my list is Hibernate. I’ve used Hibernate with several projects already but since this is one of the two frameworks I will be teaching to my Java EE class, the other one is Spring MVC, I better read “Java Persistence With Hibernate 2nd Edition by Christian Bauer and Gavin King” and have a refresher about the basics. With this said, I will try to explain things as simple as possible but you are expected to have a working knowledge of Java and SQL.
Read more…

Follow

Get every new post delivered to your Inbox.