Ben Hsu

+ Follow
since Dec 16, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Hsu


I have a simple question, I have two tables in a one-to-many relationship and I want to join them in an HQL query. How do I do that?

Lets say I have the classic example of a "departments" table and an "employees" table. I have this bit of XML in my employees.hbm.xml file:

<set name="employees" table="tblEmployee">
<key column="dept_id"/>
<one-to-many class="example.Employee"/>

I have the "Set employees" in my bean, along with the getters and setters.

I've tried "from Department.employees" and "from Department join Employees", neither worked. The first said that Department.employees could not be mapped, the second said that it needed a "dotobject" in the join.

This looks very basic. I tried looking for examples but failed. Any help would be appreciated. Thanks so much!
Hello again

what is the difference between an "abstract schema" and an entity bean? It seems they are both representations of data in the db.

I'm not clear on why we have the ejb-link tag in the DD. Can someone post an example of when you would need to use it?


Can someone clarify when you will get an IllegalStateException and when you will get a Remote/Ejb exception? It seems one case is when you need a transaction to call a method and there is no transaction, or when BMT methods are used in CMT beans or vice versa. Are there any other situations?

Thank you

on page 203 of the Head First EJB book it lists which variables can be passivated.

I don't see primitive variables (int, char, long) on the list, but I know they're serializable. Can they be passivated?

I am trying to get the Advice bean example in chapter 1 of the Head First book running.

I am running Sun's App Server 8.1 2005Q1 on Win2K.

When I try to run the application using appclient I get the following error:

C:\ejb\advice>c:\sun\appserver\bin\appclient -client AdviceAppClient.jar
WARNING: ACC003: Application threw an exception.
java.lang.NoClassDefFoundError: headfirst.AdviceHome
at AdviceClient.class$(
at AdviceClient.go(
at AdviceClient.main(

But I looked at my AdviceAppClient.jar and the headfirst\AdviceHome.class file is in there!

C:\ejb\advice>jar -tvf AdviceAppClient.jar
1417 Mon Dec 19 14:49:52 EST 2005 AdviceClient.class
93 Mon Dec 19 14:49:52 EST 2005 META-INF/sun-j2ee-ri.project
1064 Mon Dec 19 14:49:52 EST 2005 app-client-ic.jar
226 Mon Dec 19 14:49:52 EST 2005 headfirst/Advice.class
1176 Mon Dec 19 14:49:52 EST 2005 headfirst/AdviceBean.class
262 Mon Dec 19 14:49:52 EST 2005 headfirst/AdviceHome.class
1186 Mon Dec 19 14:49:52 EST 2005 ejb-jar-ic.jar
200 Mon Dec 19 14:49:52 EST 2005 META-INF/MANIFEST.MF
477 Mon Dec 19 14:49:52 EST 2005 META-INF/application.xml
354 Mon Dec 19 14:49:52 EST 2005 META-INF/sun-application.xml

Does anybody have any advice? Thank yous in advance.

I'm trying to get through the AdviceBean example in chapter 1. I'm having some trouble with my setup.

First, when I click "OK" on the Verifier screen I get this exception: file:\C:\DOCUME~1\bhsu\LOCALS~1\Temp\Results16368
67.txt (The filename, directory name, or volume label syntax is incorrect)
at Method)
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandl
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandl
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp

Secondly, it is not able to connect to my server at localhost. I know I changed one of the port settings to get the server to start, maybe its looking at the wrong port? The output of "j2ee -verbose" follows:

C:\j2sdkee1.3.1\bin>.\j2ee -verbose
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource =
Starting JMS service...
Initialization complete - waiting for client requests
Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties
Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties
Starting web service at port: 8000
Starting secure web service at port: 7000
J2EE SDK/1.3.1
Starting web service at port: 9191
J2EE SDK/1.3.1
J2EE server startup complete.

I am running the 1.3.1 Reference implementation under Win2K