Intellij Idea is really Groovy

I‘ve been an Intellij Idea follower for more than 5 years now. I’ve never really made the move to Eclipse, unless I really have to on rare occasions. Here is another example of how good Idea is. I’ve been developing a little bit with Groovy and recently with Grails. I was sad not to see any Groovy features in the […]

Read More →

Signing copies of my book

Saturday the 30th of June I‘ll be at the Parisian library Le Monde en Tique signing copies of my book from 3:30pm to 6pm. Thanks to Jean Demetreau for organizing this event. So, if you want to have a drink, talk about Java EE 5 and even buy a book and get it signed, it‘s the right moment, at the right place (the library is really nice and you can even see Notre Dame)

Read More →

Java EE 5 Book Chat

Next Tuesday from 5pm to 6pm French time, the Journal Du Net is organizing a chat (in French) about the Java EE 5 book I wrote. I’ll be on the other side of the computer answering questions about the content of the book but also Java EE 5 in general. You just have to enroll and be ready on Tuesday afternoon. See you there.

Read More →

Java EE 5 Book is out

Just to let you know that the book I wrote about Java EE 5 is out. I‘ve blogged before about its content and I’ve also written a presentaion on my web site. The book helps expert Java developers to write an e-commerce website with the lastest Java EE 5 specifications (EJB 3, JPA, JSF, JSP, JMS, JavaMail) running on GlassFish and Derby. The book is written in french but english speaker can also download the code of the application and follow the instructions to install and run the application. For french readers (or any person willing to learn Java EE 5 and french at the same time) you can buy it online at Eyrolles or Amazon

Read More →

Java EE version history: Help Needed !!!

I was trying to do a study about the evolution of Java in terms of the langage (how many versions, how many APIs in each version, main features…), its popularity (how many book written in the last 10 years, evolution of the market, job offers in the last 10 years…), its enterprise version (versions of J2EE, how many specifications in each version…)… but I‘m giving up. Too difficult. I will spend the next years trying to read articles, compare figures, sort out dates. Java is evolving fine, full stop. In my research I found a very good article on Wikipedia about Java version history. Because the same information on JEE was missing I’ve created a new article called Java EE version history. It‘s just a start and it needs alot of work still. If anybody is willing to help on that, feel free.

Read More →

Article: Generate an XML Document from an Object Model with JAXB 2

I‘ve just published an article about JAXB 2 on DevX web site. JAXB (Java Architecture for XML Binding) allows you to perform XML-to-Java data binding and generate Java classes from XML schemas and vice-versa. But in this article I mainly focus on marshalling (generate XML from Java objects). You will see how easy it is to generate XML without doing much (thanks to coding by exception). Then, I introduce a set of annotations that enable to customize the XML mapping. At the end of the article I make a reference to two other articles I wrote on JPA. Because I’ve used the same object model on all articles, I give an example of a class that can be persisted in a database using JPA annotations and binds to XML using JAXB annotations. As I’ve blogged before, this over used of annotations can be dangerous because code gets pretty messy. If you have specific needs, it‘s good to know that you can do it (JPA & JAXB in the same class). Otherwise, you should focus on modeling your classes with the right responsabilities.

Read More →

Learn Java EE 5 at Sun Tech Day (Paris)

Just to let you know that I will be presenting my book at the GlassFish Community User Group during the Sun Tech Day in Paris. It will be a quick 15 minutes talk called Learn Java EE 5 on Wednesday the 21th of March around 11 am. I know, 15 minutes is a bit quick to learn Java EE 5, that‘s why you will have to buy my book (if you read French of course). I would like to thank Alexis Moussine-Pouchkine for giving me this opportunity as well as my editor Eyrolles for letting me talk about a book that is not yet published (planed for mid-april). See you at the conference.

Read More →

Java Black Belt will be at university

Few weeks ago I‘ve posted about trying Java Black Belt at the University to test the level of our students. We made 40 students take 3 exams (JSP, Servlet and EJB) and got their feedback. Being French students we had some “I didn‘t understand every questions”. We decided not to take that into account because engineering students should have a good technical English understanding. Some students thought the tests were too difficult, some thought they were easy… but all thought it was a good way to know about certifications (some mentioned Sun certifications). With the teachers involved in this test we decided to use Java Black Belt at the beginning of each semesters to test the knowledge of our students. Clearly, if some student terribly fails we will ask him/her to go back to the library and read a couple more books. I want to thank John Rizzo and Gonzague Lefere who gave us the opportunity to do this test. These guys have had a great idea, Java Black Belt rocks and I hope it will have a certification recognition within the Java world.

Read More →

Why is JavaPolis so cheap (or why are IT conferences so expensive)

I‘ve been playing a bit with Groovy and I‘ve attended a Grails presentation done by Guillaume Laforge back in January. I thought it was really good and when he mentioned the Grails conference in London I thought “Let’s go! The conference is in May, just during my birthday, I love London, I have plenty of friends there, it would be a good oportunity to know a bit more about Grails, meet people at the conference and have some English and Irish beer” . Recently the registration opened and to my surprise I saw that the first International Grails eXchange 2007 conference is at 1000 euros (700£). I compared the price with the conferences in the near future and this is what you can get for a 3 days conference: 1350 euros ($1795) to go to TheServerSide Java Symposium-Europe in Barcelona, 1694 euros to JAOO, 1742 euros to QCon or 1350 euros ($1795) to Java One. Plus travel and hotel costs obviously. I can’t believe JavaPolis was only 200 euros for such a good conference. Is there a reason why JavaPolis, a huge Java conference (2800 participants in December), was at 200 and the first Grails conference is at 1000 ? I know London is an expensive place, the Barbican center must charge quite a bit, but why are IT conferences so expensive in general? Stephan Janssen, can you tell us your secret?

Read More →

Demo of the Petstore application

In the Java EE 5 book, you will have to develop a web and a swing application that talk to an EJB 3 back end. In this Flash animation, you’ll see how to use the Petstore web application. First It browses the catalog of pets, then logs a user on, who buys a few animals, adds them to my shopping cart, changes some quantities of the shopping cart and then checks out. In this animation you can see the administration console. It is developed in Swing and used to create/modify/remove items of the catalog as well as having a view on customer and orders.

Read More →

www.javasoft.com

I was clearing my old bookmarks and adding them to magnolia when I realized that Java Technology was pointing to www.javasoft.com. A long time ago (1998/1999) that was the link to java.sun.com. So now, if you type www.javasoft.com you’ll be automatically redirected to java.sun.com. Even on Wikipedia, if you type JavaSoft you’ll be forwarded to Sun Microsystem. There is just Webopedia that tells you that JavaSoft is the business unit of Sun Microsystems that is responsible for Java technology . Is that true? Am I the only one to still use java.sun.com? Have I been using Java for too long? Time to change? Time to be more Groovy maybe ;o)

Read More →

Article: Master the New Persistence Paradigm with JPA

I have to say, I believe in JPA. Being a former BEA consultant, I used entity beans at a very early stage of the spec and was one of the first to do a prototype of entity beans 2.0 for a customer with a beta version of weblogic (6.0 if I still remember back in 2001). I thought that wasn‘t very good (to be polite). We had customers doing so many funny things with entity beans that it couldn‘t be right. The spec was too difficult and customers didn‘t have a clue to use it the right way. And then Hibernate arrived, and now JPA. I believe the JPA spec will be the one in terms of ORM because it‘s inspired by excellent frameworks such as Hibernate or TopLink, uses annotations which gets rid off XML config files and it looks like everybody around the JCP table agreed on it (not like JDO, R.I.P). Of course there are still things to be improved, but for a 1.0 it‘s not bad at all. I‘ve written a first article about JPA (second coming soon) for DevX. It explains the basic mapping annotations, one-to-one relationship, Entity Manager and how to use JPQL. The second is more advanced and deals with inheritance, one-to-many, many-to-many relationships and JPQL. I‘ll let you know when it‘s out. I would like to thank Thierry Balla, David Dewalle, Matthieu Riou and Thomas Verin for reading the articles before they […]

Read More →

Java Black Belt at University

I‘m quite excited. At the CNAM University we’ve decided to try Java Black Belt with our students. The idea is to use JBB to ensure a minimum level of Java within our students. Thanks to John Rizzo (who I met at JavaPolis) and Gonzague Lefere who‘ve setup a temporary server just for our IT department. Our students will have the week of the 5th of february to pass 3 Java Black Belt exams (JSP, Servlet and EJB). We will then get their feedback to see if we will carry on with Java Black Belt or not. Such a test is quite a novelty for the CNAM University. Usually students have to sit an exam at university. In our case, they will do the Java Black Belt tests from home (knowing that they can invite Java friends for diner ;o) But we want to give it a try. And our idea is not really to use Java Black Belt to grade them and therefore make them pass the year or not. It‘s more to know their level of Java so we can start the year with the same kind of students. I would let you know about the feedbacks and our plans to adopt Java Black Belt as an exam tool.

Read More →

Java EE 5 Book – What, When, Who

As I‘ve posted back in september, the book I’ve written uses Java EE 5 to develop a good old PetStore-like application. It’s written in French and will be published by Eyrolles at the end of March or begining of April. It is part of the Les cahiers du programmeur collection (programmer‘s book). This collection is quite pragmatic and focuses on a hands-on approach. The books always start with a presentation of the application to develop, and after, chapter by chapter, add functionnalities and technologies. All that is written in two columns : one for the main subjects, and a smaller one for references, ideas, questions, definitions and so on. Here is the structure of my book: Chapter 1 presents the case study of an e-commerce application inspired by the Sun’s Java PetStore Blueprint. The fictitious company Yaps wants to computerize its activity of selling domestic animals. The application uses a webapp for the customers, a Swing app for the employees and needs to exchange data with external partners. UML, Use Cases Chapter 2 concentrates on the technical and software architecture of the application called Yaps PetStore. This chapter briefly presents the tools and APIs used for the development. Java 5, HTML, XML, Java EE 5, Blueprint, Design Patterns, UML The installation and the configuration of the tools are done in chapter 3. JDK, Ant, GlassFish, Derby, TopLink In Chapter 4 we develop the persistent objects of the application. JPA, Entity […]

Read More →

I’ve been tagged – Six things you don’t know about me

Yes, I‘ve been tagged by Matthieu… a long time ago. I should have blogged back a month ago but because of finishing my book I haven‘t had time to do it. I deserve a penalty for beeing so late. So, here are six things (instead of five) about me that (nearly) nobody knows : Tell me a word and I‘ll sing you a song. I‘m this kind of guy that you have to stop from singing each time you say something. I always find a match between a word and a song (mainly 60‘s and 70‘s music) I‘m passionate about religions (with an ‘s‘). Beeing a complete atheist makes life easier to read any kind of book about any kind of religion. After Java, religious books are the ones I read the most. I know which time it is (+/- 15 minutes). Because of not wearing a watch for so long, I‘ve developped this sense of knowing what the time is… even at night with no sun. I love any kind of art (mainly modern). My wife doesn‘t need to drag me to go and see boring stuff like art exhibition, ballet or abstract theatre play. I hate dogs, well, to be precise I hate people who have dogs. Beleive it or not, I still find a bit of time to play jazz with my band. Now I’m supposed to tag five others. But because I‘ve waited so long, all […]

Read More →

Java EE 5 Book – The End

Today I‘ve uploaded all my Open Office files to Eyrolles FTP server. That’s it, I’ve finished writing my book about Java EE 5. I will blog later about its content. I just want to thank my team of readers : Matthieu Riou, Alexis Midon, Zouheir Cadi and David Dewalle. Thanks guys, you‘ve been a great help. The book will benefit from your comments and expertise. And sorry for making you work so hard on the last weeks. I would also like to thank JetBrains and Visual Paradigm for giving me a free licence of their software. And of course, many thanks to my wife who didn‘t divorce me while I was writing on evenings, nights, early mornings and entire week-ends. I‘ll blog more later. But now, I just want to go out, have some sun, see some real people and enjoy life again.

Read More →

JavaPolis 2006 – Back Home

Well, how to say that in a simple way: JavaPolis 2006 was great. Here are more details. Organisation First of all, the organisation was amazing. JavaPolis is not organised by Sun, BEA, IBM, Oracle… but by the BeJUG (Belgium Java User Group). Guys like you and me who decided 5 years ago to create such an event that became international […]

Read More →

JavaPolis 2006 – Leaving tomorow morning

God, I‘m so involved in finishing writing my book that I’ve completly forgotten talking about JavaPolis. I’m leaving tomorow from Paris in an early train (6:55am) and will present a Quicky about JUnit 4 on Thursday. I‘ve already picked up the sessions I want to attend, mainly JEE, Scripting languages and a bit of JSE. A couple of former BEA colleagues should be there and a few french open source actors too. Hope I will have enough time to attend all the sessions I want and have a couple of beers with them.

Read More →

Writing a book about Java EE 5

A couple of days ago a friend sent me an email saying that I haven‘t blogged for few weeks now. The reason is that I‘m writing a book about Java EE 5 and it‘s taking me a lot of time (after work and in the week-ends). The chapters will roughtly be : * Presentation of Java EE 5 * Presentation of the Architecture of the application to develop * Java Persistent API * Stateless EJB 3.0 * JNDI an remote access with swing client * JSF 1.2 and JSP 2.1 (Unified EL) * Stateful EJB * JMS and MDB * Web Services (with Jaxb 2) It‘s a practical book, not a reference one, so there is only 30/40 pages per chapter with external references to go to. It‘s aimed at experienced java developpers who have had web development experience. I am a JBoss/Hibernate user but unfortunately I had to leave these frameworks because not really Java EE 5 compliant (stil JSP 2 and JSF 1.1). I‘m using Glassfish with Toplink and Derby. I lost a bit of time with this switch but it‘s ok. I didn‘t know Glassfish before and I‘m quite impressed with what they‘ve done. Ok, have to go and I will blog more about what I‘m doing… I should publish an article about Java EE 5. PS : JSF is driving me mad

Read More →

How to unit test CRUD operations

I like to unit test CRUD (Create, Read, Update, Delete) operations for my domain objects as well as find all. I use the same template again and again, it’s quick to do and makes sure that the basic operations work. Here is what I do : * A first find all to get all the objects from the database * Create an object with random values and persist it into the database * Find the created object from the database * Make sure it exists * Make sure it has the right random values * Update the created object with other random values into the database * Find the updated object from the database * Make sure it still exists * Make sure it has the new random values * A second find all makes sure that there is one more object in the database * Delete the object from the database * Find the object from the database * Make sure it doesn’t exist * A third find all makes sure that there is the initial number of objects in the database Here is the (simplified) JUnit code that tests the CRUD operations for an Item. @Test public void testCRUD() throws Exception { // Gets two random numbers Long random = getRandom(); Long updateRandom = getRandom(); // Item is the domain object Item item = new Item(); // The method findAll brings back all the objects from the DB […]

Read More →

HelloWorld with JPA, Hibernate and MySql

I love Hello Worlds. So when I read the blog HelloWorld with JPA, TopLink and MySql I’ve quickly copied/pasted the code, downloaded everyhting and made it work. Good. But because I’m more a Hibernate user, I thought, let’s give it a try with the same example but using Hibernate EntityManager instead of Toplink. So here is the same simple example of standalone java application using Java Persistence API (JPA), Hibernate, and MySql 5. Here is what you have to do : * First, download Hibernate Core 3.2.CR2, Hibernate Annotations 3.2.0 CR1 and Hibernate EntityManager 3.2.0 CR1 * Write the META-INF/persistence.xml file <persistence> <persistence-unit name="hello-world" transaction-type="RESOURCE_LOCAL"> <class>com.foo.Greeting</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create"/> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> </properties> </persistence-unit> </persistence> * Use the same Entity class and Main class than the one written in the HelloWorld with JPA, TopLink and MySql blog * Start MySQL * Compile and run the project with the folowing classpath java cp ..\classes;%LIB%\ejb3-persistence.jar; %LIB%\hibernate-entitymanager.jar;%LIB%\hibernate3.jar;%LIB%\jboss-common.jar; %LIB%\dom4j-1.6.1.jar;%LIB%\hibernate-annotations.jar;%LIB%\commons-logging-1.0.4.jar; %LIB%\cglib-2.1.3.jar;%LIB%\javassist.jar;%LIB%\commons-collections-2.1.1.jar; %LIB%\mysql-connector-java-5.0.3-bin.jar;%LIB%\ehcache-1.2.jar;%LIB%\asm.jar; %LIB%\jta.jar com.foo.HelloWorld

Read More →

Article on JUnit 4

I’ve published an article about JUnit 4 on DevX : Get Acquainted with the New Advanced Features of JUnit 4. JUnit 4 has changed a lot and it looks like there is much more to come. This article shows you how to migrate from JUnit 3.8 to JUnit 4 and gives you an overview of JUnit 4 new features. An article is never written alone. So first of all I would like to thank my wife Denise who read and corrected a boring technical article that she didn’t understand a word. Second, Lori Piquet from JupiterMedia for his help and expertise in writing articles. And a special thanks to both my friends Alexis Midon and Zouheir Cadi who took a bit of time to review this article. Do not hesitate to post comments.

Read More →

Annotations are great ! Really ?

Do you remember 6/7 years ago. EJBs were the big thing and with them came deployment descriptor written in XML. Then Webapp with their web.xml, and then Enterprise applications with their application.xml. XML was everywhere, XML was cool. Imagine, you can write your Java code, deploy it and after just twist bits and pieces in your XML files. XML, XML… Then we had SAX, DOM, JAXB, Castor, XSL, XSLT, Schemas, DTD… God, life became so flexible. Too flexible ? Of course ! XML has taken over our lives, we all hate XML now. We hate it so much that we started using xDoclet to get rid of it. But now, thanks to Java 5, we are really getting rid of XML and giving up all this XML flexible into more rigid annotations. But it‘s so much better : code and annotations are at the same place, on the same class, on the same method. Much better, easier to read. You see, annotations are so cool that we use them for persistence (Hibernate, JPA…), components (EJB 3), unit testing (JUnit 4), XML (with JAXB 2)… and so on. Yes, I tell you, annotations are great ! And there is no way that in 6/7 years we will end up coding this : @Entity @Name('componentName') @Inheritance @Scope(ScopeType.CONVERSATION) @Logger('loggerName') @TransactionAttribute(NEVER) @Remote({examples.Animal.class}) @ExcludeDefaultInterceptors @NamedQuery(name='findAllAnimals') class Animal extends Creature ( @Id @SequenceGenerator(name='ANIMAL_SEQ', allocationSize=25) @GeneratedValue(strategy=SEQUENCE, generator='ANIM_SEQ') @Column(name='ANIM_ID') private String id @AssociationOverride @Enumerated private Owner owner @Deprecated […]

Read More →

JAXB 2.0 Hello World

For people who have played with JAXB 1.x, JAXB 2.0 has the same beahavior: it can marshall/unmarshall object from/to XML. But the syntax is completly different. It uses all kind of annotations. This blog is just about writing and executing a good old Hello World with JAXB 2.0. First you need to download and install the binary. For the following example you will just need to put jaxb-api.jar and jaxb-impl.jar in your classpath. The following code represents a HelloWorld class with two attributes. The main method creates a HelloWorld object, sets some values, marshalles it to the hello.xml file, displays the xml representation, unmarshalles the xml file into a HelloWord and displays the toString method : import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlRootElement; import java.io.File; import java.io.FileOutputStream; @XmlRootElement public class HelloWorld { private String hello; private Integer world; public String getHello() { return hello; } public void setHello(String hello) { this.hello = hello; } public Integer getWorld() { return world; } public void setWorld(Integer world) { this.world = world; } public String toString() { return hello "-" world; } public static void main(String[] args) throws Exception { // Set up file and JAXB context final File file = new File("hello.xml"); JAXBContext context = JAXBContext.newInstance(HelloWorld.class); // Creates a HelloWorld object HelloWorld hw = new HelloWorld(); hw.setHello("Hello !!!"); hw.setWorld(1234); // From a HelloWorld object creates a hello.xml file Marshaller m = context.createMarshaller(); m.marshal(hw, new FileOutputStream(file)); m.marshal(hw, System.out); // From the hello.xml […]

Read More →