JBoss with SQL Server and EJB3 is giving me a hard time

Jeroen | June 23, 2009 0:28 | 0:28

Today I had a bit of a fuss with JBoss and SQL Server. For some reason, when I declare an entity with an Id field, the persistency layer tries to push a bad query to the database.

Let me explain.

I’ve got an entity sort of looking like this:

@Entity
public class Contract {

@Id
@GeneratedValue(strategy = GenerationType.Identity)
private int contractId;
...
}

When tryin to persist this through the entity manager SQL trace on MS SQL show a query somewhat looking like:

insert into Contract (contractid, ...) values (null, ...)

You see, a null value. Sounds reasonable, I didn’t set any value on the contractid field. BUT the persistency layer should not try to insert anything into the contractid column, because MSSQL doesn’t allow it. The above SQL results in a “DEFAULT or NULL are not allowed as explicit identity values.” I’m not sure what to try next though, everywhere I looked on the internet, all examples boil down too: “Something similar should work in MS SQL too, but I haven’t tested that…”

Better luck tomorrow. For now, I googled my brains out trying to find anything helpfull.

Anybody out there have any suggestions?

Update on the next day:
It turns out that the problem was the dialect configured in the Hibernate properties in the persistence.xml. By default our development environment enters the right value for Hypersonic DB, while it should actually be like this:

<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

And now it all works. A default SQL Server 2005 with JBoss and the latest MSSQL JDBC driver, all running EJB3.

Upgraded Wordpress to 2.8

Jeroen | June 12, 2009 10:56 | 10:56

I’ve updated Wordpress to 2.8 last night. I haven’t seen any problems myself so far. But if you do notice something, please let me know.

Which reminds me, does the mail form still work after this update… I’ll go check that right now. :)

.
.
.
It still works. :)

Back from the JavaOne 2009

Jeroen | June 10, 2009 10:21 | 10:21

Phew, back from the JavaOne 2009 again.

Too bad Jonathan's assistent didn't allow my camera to focus. First time I’ve been there. And boy could you feel the recession at the JavaOne… I think the number of visitors was at an all time low. Also in San Francisco itself recession was around you. Loads and loads of properties available for lease or sale.

But me and my colleagues did our best to support the global and local economy by living large. :) Besides the conference we did all sorts of fun activities. I even biked the Golden Gate the last Friday afternoon.

I also learned a valuable lesson when returning from another time-zone. When I got home I did some things and then went to my girl’s place. I should’ve asked her to keep me awake at all costs. Sunday I sat down on her couch and I kind of instantly fell asleep. I paid the price on Monday and Tuesday. Fortunately my employer was very understanding about Monday and Tuesday I’ll recover by working a few extra hours this week or next week. :)

More to come later. Suffice to say that on record nobody from Sun was allowed to spill any details on the Oracle/Sun merger. I understood of the record that there will be another JavaOne next year. Let’s hope that by then it is clear what will happen with Java, cause right now it’s anybodies guess what Oracle has in store for us. I’m expecting a whole lot, but it is still a bit early to say what exactly Oracle will keep and what Oracle will throw away. I do think JavaFX is here to stay though, the new JavaFX 1.2 is a major improvement compared to the 1.1 release. Check Paul Bakker’s entry on JavaFX for more details.

Too bad the assistant of Jonathan Swartz didn’t allow my camera to focus properly.

Also many thanks to Bert, Paul, Marcel and Hans for being such great travel companions throughout the week.

AVG 8 and Mozilla Thunderbird

Jeroen | May 2, 2009 19:10 | 19:10

Something I ran into on a system of a relative.

When running AVG 8’s outbound mail scanner and your ISP does not require you to provide a username and password when connecting for an outbound SMTP session…

Make sure that you do NOT check the checkbox in the SMTP settings dialog near the username and password field in ThunderBird. If you do, you probably have trouble sending email.

This seems to only happen with AVG 8 or later when you check the scan outgoing messages option in AVG system tray application.

Yup, this time it seems to be really it for SUN

Jeroen | April 20, 2009 14:26 | 14:26

It seems Oracle has put forward a bid on SUN Microsystems. Sun apparently has accepted this offer and both parties are now in final negotiations.

Personally I didn’t see this one coming. The IBM/Sun brush a short while ago was kind of obvious to me. Still a bit of a surprise, but yeah IBM absorbing SUN I can dig that.

Now Oracle has stepped up to the plate and dumped a load of money on the table. Oracle never has been my favourite when it came to Java related technology. Lots of cool demo’s that are hard to reproduce in real life situations if you ask me. Also Oracle doesn’t give me that welcoming feeling when getting into contact with them. I guess we’ll just have to wait and see how this ordeal is going to affect Java in general.

I see a lot of competition between IBM and Oracle in the future. Because let’s just face it, is there any other big Java player to speak of if this deal gets finalised? There just aren’t any other vendors that could offer a complete no holds barred JEE stack besides those two big names.

Latest iPhone Wordpress app crashes a lot

Jeroen | April 15, 2009 22:48 | 22:48

While posting from the J-Spring conference with my iPhone I noticed the Wordpress App (v.1.21) crashed a lot when trying to upload pictures. It worked wonderful at the last J-Fall. I sure hope they’ll fix this, cause I can not find a solution or workaround on the web at the moment. Perhaps re-installing the Wordpress App might work?

J-Spring: That’s it for today

Jeroen | April 15, 2009 15:45 | 15:45

I’ve decided to skip the last round of sessions, it’s sunny today and air in the session rooms is very warm and stale. Also the battery if my phone is almost dead. :)

Update:
I’ve updated all the posts of today, checked spelling, adjusted tags and uploaded photo’s. Enjoy….

J-Spring: Brainfuck’s quest for CafeBabe – a journey through JVM land

Jeroen | April 15, 2009 14:40 | 14:40

Jeroen Benckhuijsen has this oddly called session about implementing a certain language on top of the Java VM. He’s telling a bit about implementing a custom language using pure byte code.

He’s using an interesting approach. Weird slides with a funny story.

It’s a technical talk about the how class files are laid out and how they work with the Java memory model. It’s a lot info available on the web. So I’ll shut up now. I’ll post links later.

IMG_0081.JPG

J-Spring: SOA, it’s a hard knock life

Jeroen | April 15, 2009 13:23 | 13:23

Tijs Rademakers has a presentation on SOAs in practice. What problems do you encounter when implementing a SOA. After having discussed the advantages of SOAs he dives into the rumours that SOA is dead. But hey, services are the future. Anne Thomas Manes has a contradicting statement.

It is true that SOA has not proven to reduce costs. SOA projects take longer to implement because the services have to be implemented in a re-usable way. Often a SOA project boils down to an ESB selection, but is that deciding on what SOA architecture you want to implement? Discussions often focus on the implementing technology and not the underlying SOA architecture.

Tijs introduces a case study. A COBOL applications of 14500 function points. It has been transferred to a SOA based architecture. A lot of companies belief that implementing everything as a web service is the same as implementing a service architecture. But SOA is more then that. While a bottom up approach might work, a top down view is important as well. Implementing reusable services is only possible if you take the surrounding architectural landscape into account. A canonical data model is important to facilitate a standardised data language for all services.

SOA architectures are built according to a plan, but the legacy application being replaced is also often built based on a clear plan. Code is reused is built according to an architecture of days gone by.

Is the entire web of systems and services defined within a SOA application really that much simpler then a legacy system?

Is a SOA something you should do? And if so, what technologies should you use? Is an ESB a requirement or any of the other standards. (SOAP,WSDL,WS-,SCA,OSGi,etc.)

Implementing a service is easy. Just add @WebService. A top down and bottom up is available. The same goes for REST services with Jax-RS.

Java – XML binding can be challenging. You often need to write some custom code. This is due to JAXB v1 API. But there are better frameworks available. JAXB2 JIBD XSTREAM. New languages show the way to the future. Some aspects should be ported to Java.

It’s a bit of a strange presentation. First it’s all SOA, now we’re talking Groovy??

SCA is a good option, with it’s declarative configuration and flexibility in choosing the actual implementing technology. I should read up on SCA a bit.

OSGi is also a very impressive platform. A lot of implementations using OSGi are emerging. It supports all the service oriented functionality. Wso2’s Carbon is a nice example.

Next topic, does SOA entail the usage of an ESB? An ESB is a platform you can use to implement a SOA. but it’s just a platform with a high risk of vendor lock-in, under the hood it’s all custom proprietary. You always need custom code to integrate an ESB. Vendors push ESBs as the way to implement a SOA, but it is often nothing more then a tool to create a nasty lock-in. An ESB does a lot, use it, but be careful for the lock-in trap.

An ESB often only hides a lot of shit on an overview architecture slide.

An alternative would be a sort of guerilla SOA. Unlock lots of systems with restful services. Then don’t define a lot of rules and let it grow. All you need at a certain point you need a good way to resolve the locations of services.

In the end you need business level support to be able to do a service oriented approach. Also business has to be made aware of the initial impact of a service approach. But also of the long term benefits. Consolidation of services and systems is recommended. But never forget that business often steers on short term goals while they should look at long term goals.

IMG_0080.JPG

J-Spring: half time keynote Mod4J

Jeroen | April 15, 2009 12:30 | 12:30

Jos Warmer has the midday keynote. He has an introductory talk on the Mod4J project.

Jos is an MDA enthusiast and as always makes a case for the model driven approach. Check the Internet for more details. I’ll post some links and info later, now I’ll just sit back a bit and relax a bit before jumping into the remaining sessions.
IMG_0078.JPG