Like Zhang

Greenhorn
+ Follow
since Jan 19, 2004
Merit badge: grant badges
For More
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 Like Zhang

I just wonder if there is any easy method to get the id for an inserted object. For example I want to have some method like this:
public int addElement(Object obj); //return the id of inserted object

How to do this?? Thanks.
I checked many examples on hibernate, there are some of my questions:

1. Do I have to add the following to server.xml in Tomcat?
<Context path="/quickstart" docBase="quickstart">
<Resource name="jdbc/quickstart" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/quickstart">
.......

I mean, I already have setup the datasource in Tomcat and it works fine without hibernate. I don't know if I need to add it again in the server.xml

2. When I create the sessionFactory, should I use any parameters or just use createFactory() ?

Thanks.
I am trying to use hibernate with struts.
First, the datasource is OK because I can use traditional method: initialize context and lookup.
However,when I use hibernate method, it throws:
net.sf.hibernate.exception.GenericJDBCException: Cannot open connection

I traced down and found the error happens when I execute session.beginTransaction()

My code is like this:

sessionFactory = new Configuration().configure().buildSessionFactory();
session = sessionFactory.openSession();
System.out.println("session opened!"); //this can be printed out
transaction = session.beginTransaction();

Then after printing out "session opened", the exception is thrown.
Could anyone help me out? Thanks.
Ok, I see.
So I need to save what I need (for example, a result set) in session or cookie, and then read it out from the next JSP ?
19 years ago
Hi, I'm new to struts.
I just don't know how to use Datasource in JSP.
In Actions, I can have datasource by using GetDatasource(...) method.
However, if I use traditional method: create InitialContext, the look up by naming service, I could not obtain the datasource object.
So there is the problem, the GetDatasource(...) method looks like from the Action class, how can I use it in JSP ?
Besides, for the MVC, if JSP is the view, is it OK to read data from the database by using a bean(the Model), or should I pass all requests to database to a Controller?

Thanks very much !!!
19 years ago
I setup tomcat in my office, and it works fine.
Then I went back home, and the tomcat looks still OK(i can browse my webpage made by jsp).
However, after 2-3 hours, I cannot connect to the server from home.
Then I went back to office, and find I can still connect to the server from other PCs in office and the tomcat works OK.

So the problem is: Tomcat works fine at the first 1-2 hours(for both intranet and from other isp), but I cannot connect to the server from other isp after several hours.
Could anyone help me out? Thanks!!
19 years ago
data persistence is managed by bean...actually, defined by bean for CMP.
CMP let you define abstract method for getter and setter, but not the actual instance variable. The container will generate necessary code for database processing.
Whatever, you need to do something in your bean code even in CMP.
Transaction is defined in DD. I mean, you cannot define a method is in trasaction or not in your bean code, and you can only do that in DD.
I am study HFE and using J2EE 1.3 SDK.
cloudscape is embedded in J2EE 1.3. I can use my entity bean to read or insert data from cloudscape, but I want to see all tables in cloudscape. When I was using the deploytool, I found the "Container method" will create new table in cloudscape, but when I use "select * from ...", there is error.
For example, the container method will create MyEntityBeanTable.
Then I run "cloudscape -isql" and use standard SQL to see the content in the table, but it always report errors.
[ March 03, 2004: Message edited by: Like Zhang ]
I have the same problem!!! The SAME Exception.
I am crazy. What happens here?
Does anybody know what is going on?
Thanks a lot!!
I just cannot figure it out.
There are books for Test285 and 287, but none for 286?
For people passed 286, what book did they use? only redbook?
From my point of view, I choose SCBCD instead of SCWCD because EJB is the core of J2EE, while Servlets and JSP are covered by most other certificates, such as IBM 285-287.
I just finished SCJP 1.4, here is my plan for future:
SCJP->SCBCD->IBM 286->Weblogic Certificate or others
For SCBCD will help me bulid solid background in EJB developing, which is independent of any platform. IBM 286 will help me have knowledge in a specific.
Hi, I cannot find a book for test 286 of WSAD. There is one for Test 285, and another one for Test 287(Howard Kusher's book). While I have just taken
SCJP 1.4 and want to get a certificate of WSAD. Test 287 seems too time consuming (4 tests), and 285 seems a little low level. So I want to take Test 286.
Can I use Howard Kusher's book for that? It seems that Test 286 does not require EJB, so I plan to overlook that part and study others. Is that OK?
I am going to take SCBCD first, and then IBM's test 286 or weblogic's. So I want to setup a platform for practicing.
However, my computer has only 384m memory. The installation guide of WSAD 5.1 says it needs at least 512m. Is that the minimum requirement? How about weblogic? I have not download it yet.
20 years ago
Besides, I am considering what the next step is.
I will graduate by this August, so my purpose is to get some really valuable
certificate to find a job before it.
SCJP is only a begining. I am thinking about SCWCD, SCBCD and IBM certificate solution developer for WSAD(Test 286). I also hope to get Microsoft .NET MCAD. Thus I can have some confidence in today's cruel job market.
Maybe it's too much. Forget about .NET, I hope I could finish SCBCD by the end of March, then finish SCWCD or IBM's Test 286 before May. Is that possible?
Thanks for any advice.
20 years ago
I just passed SCJP 1.4 with 85%.
Read some books. However, I feel the Sun's online tutorial is the most clear and easy understanding, especially for collection part.
Whiz Lab's simulation is SUPER!!!I don't like those mock exams on internet, because I cannot make sure of the answer and explainnation. However, Whiz lab is good!
How long can I find my information online? I try to register on www.certmanager.net/sun, but it said there is no matching information. How soon can I register? I finished the test probally 2 hours ago. Thanks.
20 years ago