Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

C Chavan

+ Follow
since Mar 19, 2004
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 C Chavan

As the book says, request.getSession(false) is used in situation where current request MUST be associated with an existing session. This might be necessary in situation where you want to do a multi-step process (e.g. wizard like process, checkout process etc) and want to make sure everything happens within one session boundary. request.getSession(false) helps ensure that.

if you call request.getSession() or request.getSession(true), it will always return Session object, existing or new.
yes, you will need to setup the classpath to include j2ee jar files. alternately, if you are compiling from command prompt, you may specify the required JARs using javac -classpath option.
look in this forum's FAQ and Links for suggested readings. there are some SCEA related yahoo groups where you may find some additional resources (notes, articles etc).
If you read JavaDoc carefully, you will find the answer. here is some text from there -

The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the United States:


Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code. You can use getDisplayCountry to get the name of the country suitable for displaying to the user. Similarly, you can use getDisplayLanguage to get the name of the language suitable for displaying to the user. Interestingly, the getDisplayXXX methods are themselves locale-sensitive and have two versions: one that uses the default locale and one that uses the locale specified as an argument.

there is also static Locale.getDefault() method that returns Locale object for your system's default locale.
lineitem is closely related to order (or invoice) (order contains lineitem) whereas product has its own seperate identity.

lineitem is comprised of product, quantity, price etc.
since there are no member attributes in builder class, it should be thread-safe.

you may implement a builder factory (a singleton class) that will return an appropriate instance of base builder class based on the field type you pass to it. internally, you may cache either single or multiple instances of each of different type of builders and return to the caller.

public class BuilderFactory
private static HashMap _builders;
private static BuilderFactory _instance = new BuilderFactory();
private BuilderFactory(){ _builders = new HashMap(INIT_VALUE);}
public static BuilderFactory getInstance(){ return _instance;}
public Builder getBuilder(Field field){
if (field instanceof xxx){
if (_builders.contains(xxx)){
return _builders.get(xxx);
Builder blder = new XXXBuilder(field);
_builders.put(xxx, blder);
return blder;
// repeat for other types of Field classes
Consider it as washing machine. load the clothes (code) in it, add detergent (home/remote interfaces), specify cycles (deployment descriptors) and press start button (deploy). washing machine (container) will do the rest of work (transaction, pooling).
In CMT bean, the txn attribute is specified in DD and container manages txn for bean. one can check whether current txn is destined for rollback by calling boolean ejbcontext.getRollbackOnly(). there is no method to my knowledge that will tell whether there is any txn context available. you have to trust container on that

for BMT bean (session only), one can use ut.getStatus() to find out the txn status. note that, BMT bean does not allow txn to propogate in i.e. the client can not pass it's txn to BMT bean.
IMO, numbers are x=3 and y=4.

S is given value 7 (x + y) and P is given value 12 (xy).

For P, 12 can result into x=2, y=6 or x=3 and y=4. therefore, he/she can not figure of numbers x and y.

For S, 7 can result into x=2 and y=5 or x=3 and y=4.

The logic S applies is, if numbers were 2 and 5, their product (xy) will be 10 and if P has that value, he/she can figure out the numbers. If numbers were 3 and 4, their product (xy) will be 12 and if P has that value, he/she can not determine whether numbers are 2 and 6 or 3 and 4. As P says it can not figure out the numbers, it means the numbers are not 2 and 5. That leaves x=3 and y=4.
13 years ago
BMT session (SL and SF) EJBs CAN call UserTransaction methods in ejbCreate()/ejbRemove().

Check out -

Section Serving Multiple Client Types

For assignment purpose, whether to have different client type, it is for candidate to decide
you will have more orange juice in apple glass than apple juice in orange glass.
when you poured 50ml of orange juice in apple glass, it was whole 50 ml of orange juice.
when you poured 50ml of apple+orange mix in orange glass, there is less possibility that 50ml of apple juice will be poured in orange glass.
14 years ago
for 9 balls, best result can be achieved in 1 measurement. put 4 balls in each scale. if they come out equal, remaining ball is of gold. ofcourse, if the 4 balls don't weigh equal, it will take total 3 measurings to find out gold ball.
14 years ago
I am not familiar with Spring or Hibernate. Could you plz provide some features of these frameworks that are better (in terms of ease of use, features-wise, API-wise) than Session EJBs and MDBs.

Also, could you plz highlight features from these 2 frameworks that are "stolen" into EJB 3.0 draft spec.

Note: I personally find Entity EJBs limiting in certain aspects and would prefer a pluggable architecture in J2EE to do persistence.