Ben Hsu

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

Recent posts by Ben Hsu

Hi

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"/>
</set>

I have the "Set employees" in my Employees.java 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.
Hi

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?

Thanks
Hi

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
Hello

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?
Hello.

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$(AdviceClient.java:16)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:9)

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.
Hi

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:

java.io.FileNotFoundException: file:\C:\DOCUME~1\bhsu\LOCALS~1\Temp\Results16368
67.txt (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandl
er(TransformerImpl.java:1026)
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandl
er(TransformerImpl.java:934)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1083)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1066)
at com.sun.enterprise.tools.verifier.ResultsReport.generateText(ResultsR
eport.java:262)
at com.sun.enterprise.tools.verifier.ResultsReport.writeDetailsToText(Re
sultsReport.java:207)
at com.sun.enterprise.tools.verifier.ResultsReport.writeResults(ResultsR
eport.java:1268)
at com.sun.enterprise.tools.verifier.Verifier.writeDetails(Verifier.java
:1978)
at com.sun.enterprise.tools.verifier.gui.MainPanel.run(MainPanel.java:22
9)
at java.lang.Thread.run(Thread.java:595)

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
te=true
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
eDB;create=true
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB
;create=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
te=true
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
DB;create=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.co
re.RemoteXaDataSource@14d5bc9
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

Thanks!