Ann Basso

Ranch Hand
+ Follow
since Jul 26, 2007
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 Ann Basso


This is regarding the statement in JPA specification,

A persistence unit must have a name. Only one persistence unit of any given name must be defined
within a single EJB-JAR file, within a single WAR file, within a single application client jar, or within an EAR. See Section 8.2.2, “Persistence Unit Scope”.
A persistence unit that is defined at the level of an EJB-JAR, WAR, or application client jar is scoped to that EJB-JAR, WAR, or application jar respectively and is visible to the components defined in that jar or war.
A persistence unit that is defined at the level of the EAR is generally visible to all components in the application.

I am trying to understand how do you define a persistent unit at the ear level as opposed to a PU at application jar level. As I understand, an ear can contain jars and wars. So a PU defined in a jar file that is contained in an ear (e.g. /lib/somejar.jar ), is considered as defined as application jar level or ear level?

I think am confused between application jar, ejb-jar and a regular jar. Is there a difference between these? A jar file containing ejbs is ejb-jar, isn't it? so if a PU is defined in an ejb-jar, would it be considered as "ear" level? What would be a regular jar?

Sorry, I am totally confused about this and would appreciate any help !

Frits Walraven wrote:Hi Ann,

You should be able to create a filter on the default servlet.

Can you post the part of your web.xml where you define the default servlet (<servlet> and <servlet-mapping>)?


Hi Frits,
There is no definition for default servlet. That's why it is called the default servlet. When the app context is not able to match the incoming request uri to any of the url-mappings, the request is passed on to the default servlet. It generally looks for index.html/jsp or generates a 404 response. So if you call, http://localhost:8080/mywebapp/, it looks for index.jsp in document root. So I am trying to apply the filter to "/".

I have the following in my web.xml:

As I understand I am applying the filter on "default" servlet. This is what the specification says for it: "A string containing only the ’/’ character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path
and the path info is null."

When I access http://localhost:8080/mywebapp/, it shows the index.jsp page and I am also expecting this filter to execute but it is not. I don't understand why. When I chage the url pattern to /*, it does execute but not for /. I tried it on tomcat as well as glassfish.

How to I apply a filter to this default servlet?
Hi all! I have a question regarding statistical analysis and was wondering if anybody can provide any pointers.

I want to compare two methods/approaches of building a structure and find out which approach is better.

There are 10 parameters, for which I have collected data. For example, lets say one parameter is Time To Cure (TTC). I have 100 values for this "Time To Cure" parameter for each of the methods. Another parameter is Strength and so on.

The methods have to be compared based on these parameters. Every parameter is different. For example, if TTC is less for Method 1, then the method 1 is better. But if Strength is less in Method 1, then Method 2 is better and so on.

My approach is to assign weightage to each parameter and basically compute some score. But I am not sure how and what statistical functions to apply that can provide some scientific basis to the conclusion. Also, I want to know if there are enough values to make that conclusion (something to do with Significance). Or which parameter values are useless to arrive at the conclusion (if Std Dev. of some parameter is too much then may be it is statistically no good?).

Is there a standard way to do this kind of thing or are there some standard numbers that should be produced so that other can understand and appreciate the study?

thank you!

11 years ago
It there any place we can find errata for scjws mocks?
11 years ago
Thank you very much for your insight.
How about if the app is made as a web app but using Flex (or Silverlight)? Isn't Flex cross platform, cross browser?

Also, if you could please point to some beginner text on how to develop a regular webapp (no flex etc.) for mobile phones, that would be great. I am thinking that developing the view pages for mobile phones would be different from regular pages because of their size. So is your code aware of the size of the window or it just automatically gets wrapped around? I am sure there would be some standard techniques for making sure the webpages look ok on these small screen.

thank you!
12 years ago

Mark Spritzler wrote:
1) What is your target audience? Do they only have iPhones, if so, why waste time writing in other device languages.
2) Are you only doing this because you think it will make your rich? Odds are against it now.
3) Build a website app instead and all the phones can view it.
4) Write the same app in all the different languages.

I will say this, I have 4 iPhone apps, and I have written a few J2ME apps, no Android yet. And I think J2ME is done. Objective-C for iPhones and Andriod in Java are to me the only viable solutions.

Opinion given above.


Hi Mark,
Thank you very much for your response.
1. The audience is all smart phone users. Or as much as possible. Using the same app. But that doesn't seem to be possible.
2. I have an idea and I would like to work on it. If it makes me rich then great, if not, well, at least I tried
3. Webapp requires a hosting server, access/security issues, user data management. So while it will allow access to any phone, it has a big overhead as well. Keeping user data with me will be too much of a responsibility.
4. Right. Hence this post. Is there a way to figure out a way...WORA. Apparantly not

When you say J2ME is done, you mean, it's no good anymore. Right? Can a simple GUI app be developed in J2ME that can be run on all these smart phones?
Also, what do you mean by Android in Java? Do you mean J2ME code for Andriod phones?
12 years ago

I have never done any mobile app development so I don't know much about it but I want to get into it. My understanding is that an app developed for iPhone will not work on any other phone. Is that right?

So I am wondering about what platform to choose for developing GUI applications for smart phones such has iPhone. Of course, J2ME is one option but Java GUI does not look as sleek and also it is resource hungry. Now, iPhone has its own SDK, I think google droid has its own, it seems Sony is coming up with another one. So if one has to develop a sleek GUI application for all these phones, how should one go about evaluating these technologies? In other words, if you had to develop a cross smartmobile application, how would you do it?

Any pointers?
12 years ago
I am looking at the mapping given on pg. 143 of Hibernate 3.0 reference manual.

In a more complex example, imagine that the association between Employee and Organization
is maintained in an Employment table full of historical employment data. An association to the
employee's most recent employer, the one with the most recent startDate, could be mapped in
the following way:

I don't think I understand this mapping at all. The following is what my understanding is:
1. Employee class has a field named mostRecentEmployer of class Oganization.
2. There is an Employment table containing EmployeeId, OrgId, StartDate, and EndDate columns.

3. Now, where does the above <join> construct appear? In the mapping for Employee.hbm.xml or Organization.hbm? I guess, it is in Employee.hbm, right?

4. What does <key column="employeeId"/> mean? It is a key for what?
5. In the <subselect>, I don't understand "having startDate = max(startDate)". Is this HQL?

Please help me understand this. How to "read" this mapping?

thank you,

Neha Daga wrote:you did not initialize the variable "value" so it gets default null value. now when you run A class constructor it gives a call to super class constructor which calls method m1 till this time subclass (class A) constructor has not been run. so, value of variable is not initialized to "A" and hence null is printed.

Thanks for your response. Please read the original post again. The question is not why it prints null, but why it does not print null when value is made final.

Wouter Oet wrote:That's because final fields are set at compile time and non-final fields at run-time.

That doesn't seem entirely true because the following code for A also prints null even though value is final.

My guess is that public final String value = "A"; is treated specially and value is basically made a compile time constant.
Please consider this code:

This, understandably, prints:

value in A's m1() = null

Now, if I just add "final" keyword to A's value field. The output is :

value in A's m1() = A

I am unable to understand why? Can someone point me to any relevant rule in JLS or tutorial?
I am a netbeans person but I am now trying to move to Eclipse. To do this, I am developing a simple a web application which has spring and hibernate components. I am aware of the command line tools for hibernate but I was wondering if there is a standard/commonly used set of Eclipse plugins that allow you to do all the activities (such as managing xml files, generating mappings/classes, etc) right from the IDE itself. I mean, when I am using Eclipse, it is possible to do all the tasks (that we do from command line ) from within the IDE itself?

Is there any place where I can find some common practices to handle these things?

thank you,
The text that follows the above code reads:

This filter acts as an interceptor for servlet requests. It runs every time a request hits the server and must be processed. It needs the SessionFactory on startup, and it gets it from the HibernateUtil helper class. When the request arrives, you start a database transaction and open a new persistence context. After the controller has executed and the view has been rendered, you commit the database transaction. Thanks to Hibernate’s auomatic Session binding and propagation, this is also automatically the scope of the persistence context.

And what about the hibernate session? What do I do with it??? Close it, right?
I am looking at the filter given on Pg 737 of Manning's JPWH and I observed that it in the doFilter() method, the transaction is committed/rollbacked but the hibernate session is not closed at the end of the method.

Shouldn't there be a called to sf.getCurrentSession().close() in a finally block? Has it been left on purpose (i.e. is not needed) or is just an oversight?

thank you!