Amol Katyare

Ranch Hand
+ Follow
since Apr 02, 2007
Merit badge: grant badges
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 Amol Katyare

It depends on which application server you are using. You may need to check out documentation for that.
This is what my understanding is. Please correct if am wrong.

isCallerInRole() - Not allowed in MDB.
Reason is obvious - No client available for security check to be performed.

getCallerInPrincipal() and @RunAs - Allowed.
Reason - No security context passed onto onMessage() but JMS agent/provider can allow user to configure credentials that EJBContainer may pass onto MDB. I think without configuring credentials, by default getCallerPrincipal.getName() retruns "Anonymous". Consider a case if onMessage() is further performing certain task (e.g. calling a service from other domain that require authenticate users only or doing persistence related stuffs) wherein it has to have certain role associate with it. I guess, then we can assign desired role for MDB.

In a nutshell, security works in MDB not taking into account client's credentials but with JMS provider's credential mappings.

Thanks Deepika. But it is not listed in book errata
As described on pg - 275, If omitted, the "name" property takes the form -

<relationship field/property name>_<name of the referenced primary key column>

I think there is a print mistake on pg -274 when it says "The USERS table contains a foreign key named USERS_BILLING_ID that refers to BILLING_INFO tabel's BILLING_ID primary key".
USER_BILLING_ID should be read as just BILLING_ID (actual name of the column in USERS table)

And I wonder if the name="USER_BILLING_ID" should have been replaced by name="BILLINGINFO_BILLING_ID". Is it a print mistake again?

Could someone please confirm?
Congratulations. Perfect score

Chumak Eduard wrote:Hi Ranchers!
I'd like to notice that SCBCD is the easiest one...



I hope I get the same feeling when I appear
13 years ago
Treimin - Congratulations
13 years ago

Ernest Friedman-Hill wrote:Because the first branch of the ?: is an int, the second is reified to an int as well



Please correct my understanding if wrong.

The above statement holds true only while assigning a value using :? ternary operator and not during if-else condition check.

And how does compiler come to know if the first branch is actually int without invoking intValue() of the first branch then? Looks like it doesn't actually invoke intValue() but just decides on datatype before jumping onto second branch.

Considering this what actually happens at runtime, it does make sense that in the second branch it would first unbox and box again.

But the basic question is why it is supposed to even go to first branch?

I'm sorry if I sound too much confused.
13 years ago
My experience with using EJB Timerservice wasn't good esp. for the reason it seems to be mandatory calling timer.cancel() each time the server is restarted / server crashes. It is absolutely fine for invoking say some batch process at regular interval of time. But as advised in EJB3 in Action, it is ofcourse not a very good option for implementing some real time services which are triggered by timer service. "Quartz" is one of the best appropriate options.

The problem that I faced was, sometimes when server was restarted, I used to get multiple invocation of timeout method successively ignoring what interval I had set. After some analysis, I found the reason. As timer is persisted (I do not know how it is implemented by container), before the code to create timer is actually run, previously persisted instance gets invoked and it disturbs the whole timer cycle. Once fresh timer is started, then it gets regularised. Workaround available is to check if any timer is already running or not then not to create new timer instead use already running one. OR more elegant way is to cancel timer each time you stop server so that regular cycle would be invoked next time you start it up.

My questions

1. Does any one have idea how timer is persisted by container (may be in some DB managed by application sever)?
2. I know we can have control over when to hit first timeout() by specifying milliseconds in first argument. But it might be the case I do not want to invoke timeout() before my server is started completely. But how to have control over the persited instance of the timer and how to refrain it from hitting timeout() unless server is started?

Thanks,
Amol.
If you are looking for why targetEntity is used - it is meant for giving the name of the class when class is not mentioned on generics.

e.g. If you have a relationship like


and for some reason you do not want to use generics then how would persitence provider know which type of Set it needs to mapped to. That's why we need targetEntity.

Quite interesting thread

First of all, Thanks Reza for giving us EJB3 in Action - such a wonderful book. I really hope, more and more people go through it so that they would get familiar with the simplicity of EJB 3 over EJB 2.1. The book has been written with very simplified contents, flow is very good (esp. for beginners). Giving ample code snipptes with pointers to highlight important lines is really a good way to grab attention of readers. The same example of "ActionBazzar" carried out through out the book glues you to book. You can't wait to get familiar with newly added features (esp. annotations) and how they are used to serve your requirement.

However, it would be great to enhance "Best Practises" section and have more practical problems/solutions into it. I think one can list down the problems that developers usually face and what should be done to avoid it. E.g. I see many people have posted when they see problem with dealing with detached entities, getting JPA excpetion at persistence level. configuration questions regarding persistence.xml etc. Also, confusion between how to use JPA in EE and SE context. etc.

Coming back to original discussion topic of this thread...

Well, IBM + SUN deal may have lost it's balance but Oracle did it (Great anticipation by Kram Nart ).

What would be your views on the future of Java (and hence future of Sun certification exams) after reading this ?
Probably, you are missing j2ee.jar on classpath. I had the same trouble with eclipse.
Me too not having hands on NetBean's Swing editor. There has to be some option setting that would allow you modify generated code.
13 years ago