Skip to main content

Posts

Showing posts from November, 2007

entityManager.createQuery("Select e from "+MyEntity.class.getName()+" e") in glassfish

I've been using EJB3 with jboss for a long time - and I've got use to this way of writing my ejb3 persistence queries: entityManager.createQuery("Select e from "+MyEntity.class.getName()+" e") which is also convenient considering refactoring compared to "Select e from MyEntity e". But the EJB3 persistence spec says this: "Entities are designated in query strings by their entity names. The entity name is defined by the name element of the Entity annotation (or the entity-name XML descriptor element), and defaults to the unqualified name of the entity class. Entity names are scoped within the persistence unit and must be unique within the persistence unit." And glassfish complains about the fully qualified classnames - it just want the unqualified classname (without package information). According to the spec - glassfish seems more correct to me - but the hibernate/jboss way of using fqn seems better to me - so I wonder, which one is really

LMAppletserver in Glassfish - invoking EJB3 session bean methods from your applet

The previous blog entry showed how to use LMAppletserver in a web archive (WAR) without any enterprise beans or enterprise app. It could also have been deployed to e.g. Tomcat where you don't have EJB3 session beans. In this example I'm showing how to call EJB3 session beans from your java applet using LMAppletserver. Download and start netbeans 6.0 (http://netbeans.org) Versioning -> Subversion -> Checkout Checkout the following URL: http://lmappletserver.svn.sourceforge.net/svnroot/lmappletserver/LMAppletServerEJB3 (no username or password) Right click on the newly opened LMAppletServerEJB3 project and select "Undeploy and Deploy" to deploy the project. When the server has started and everything is deployed then open this URL in your browser: http://localhost:8080/LMAppletServerEJB3-war/ The applet shows a message that is obtained by calling an EJB3 session bean method method on the server, using the RPC features of LMAppletserver. This is what happens in the

LMAppletserver in Glassfish

LMAppletserver is a toolkit for automatic deployment of java classes (or jars) to your browser, and an rpc library for easily calling methods on the server. The intention is to enable effective code reuse between the client and the server, and not have to repackage the classes for the client. Also a way of calling server methods - that is to give the feeling of coding "directly on the server". Download the example project from sourceforge.net: http://sourceforge.net/project/downloading.php?group_id=142974&use_mirror=osdn&filename=SimplestLMAppletserverProject.zip&2731151 unzip SimplestLMAppletserverProject.zip cd SimplestLMAppletserverProject ant To deploy the application to Glassfish: asadmin deploydir simplelmapp.war Open in your browser: http://localhost:8080/simplelmapp/ And see the hello world applet... The applet shows a message that is obtained by calling a business method on the server, using the RPC features of LMAppletserver. This is what happens in the

Notes on Glassfish exploded deploys vs. JBoss

While in Jboss 4.0.x I'm able to mix exploded and packaged modules in my .ear - Glassfish seems to require either fully exploded or fully packaged. E.g. if I have a packaged ejb module together with an exploded web module in an exploded .ear - this doesn't seem to work with Glassfish. Another thing is that when having exploded ejb and web (war) modules in glassfish the extension should be _jar and _war rather than .jar and .war - in JBoss dots or _ is irrelevant. What might be confusing is that the reference in application.xml to these modules is still done using dots. These are my initial experiences from trying to get the lmappletserver-addons-example (http://sourceforge.net/projects/lmappletserver) up and running with Glassfish. I've now managed to deploy it - but still there are to many errors to call it a successful deployment - will be back with more info as I make progress...