Bod Toki

Ranch Hand
+ Follow
since Sep 01, 2006
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 Bod Toki

Please can anyone give me a quick summary of how to configure the Glassfish server to lookup or inject EJBs from some remote server? Thanks.

P.S: Why isn't there a Glassfish forum? (we've got OAS, Websphere, Weblogic, JBoss, etc).

Duc Vo wrote:

Bod Toki wrote:

On the server hosting Glassfish, can you ping www.google.com from the console?


Yes I get to ping www.google.com fine on the console.


Can you try again when logging in with the service account which run Glassfish?
Is the service account local account or network account?



I don't quite understand what you mean by that. I am not too familiar with server administration stuffs. But I guess I never changed it from the defaults I got when I installed it with the Netbeans bundle.
Hey guys...

tried the code on another PC (behind the same router) and was successful.

I guess it must be some connection configuration problem with the other machine.

(I wonder how I'd fix this).

Thanks.

On the server hosting Glassfish, can you ping www.google.com from the console?


Yes I get to ping www.google.com fine on the console.


I am actually using the complete url string including protocol like this: "http://www.google.com".
Hi....

I've got this little problem. Whenever I try to connect to a web resource like this:

...I get a UnknownHostException when i set the urlStr to something like "www.google.com".
...but whenever I attempt a connect with the IP address "72.14.205.147" (the IP address of google I got from a lookup), my connection becomes successful.

Does anybody know whats going wrong? What do you suggest I do to solve this problem... I want to use the url and not the IP address.
It's looking like some DNS issues but I can't quite figure it out or a way to solve the problem. I am running this code in the Glassfish container.

Thanks.
Please can anyone point me to more references on JavaEE application clients, and the application client container (ACC)?

I'd like to know if I can start up and synchronize on threads, and if it's legal to open I/O streams.

Thanks.
Hi GoofBall...
(I'm sure you're soon going to get a message from someone in the admin about your name

Please... It's always nice to streamline your code in a post and avoid dumping all of your code in the post. The easier it is to read your post, the faster you'd get a response. Most people don't really have the patience to ward through very long request posts.

That said... Here goes my response to your post:

In entity relationships, there is usually an "owner" of the relationship. The owner table would have a reference column to probably the primary key column of the related entity table.
It turns out that it makes more sense to have the entity on the "many" side to maintain a column holding a reference to the entity on the "one" side. So JPA has it that the "many" side should be the owning side. Which ultimately means that you'd have to have a reference to the "one" entity declared in the "many" entity class.
Relating that to your problem... this means you'd have your code like this:

...That's the way you'd go by it. Sadly if you wanted to have it the other way... i.e. having the Tournament side be the "owning" side of the relationship, you'd have to deal with a JoinTable... and there is no @ManyToOne(mappedBy=""). So you'd most likely have the relationship bidirectional like I have it in the code. I think it works fine this way though... save yourself an extra table.

Have a great time.
Cheers.
When you use the UserTransaction API, you're using a high level transaction API that manages all sorts of transactional resources under the hood. Probably what the statement is attempting to say is that it is the responsibility of the container/server provider to ensure coordinated transaction management under the hood... so that when the container or bean provider begins, commits, marks for rollback, or rollback a transaction, the appropriate transactional resources are notified and coordinated.

Hope this helps.
I am currently not aware of any SCBCD (EJB exam) book available in the market. And I haven't seen anyone post about this in the forum.
What I find is that more people are studying for the exam using EJB 3 in Action (and I guess in the past Mastering EJB 3 and Orielly's EJB 3.0 book).

If you have got EJB 3 in Action, you can pay attention to chapters 1 through 11 (and maybe a glance through the later chapters) and you should be fine.
You can also search the forum for MZ's notes (I haven't seen this myself, but a lot of people around here seem to love it).
Make sure you practice your knowledge of the topics using the many SCBCD 5 exam mock exams available online (and I guess SUN's got one too).
If you are particular about studying from something really designed for the SCBCD 5 exam, then you can supplement the book with the exam packages from Whizlabs, Enthuware, or uCertify.

All the best studying for your exam.
I pretty much agree with most of the responses you have gotten so far.

So if you are asking about what exam to take next, I can give you a few hints. Seeing that you are SCJP and SCBCD... here are the others:

-SCWCD: There are more web jobs out there and I'm guessing that most people working with EJBs would be giving their projects a web face.
-SCDJWS: Like you probably know, you can open a webservice frontend to your EJBs so you might want to take a deep into what java web services are all about.
-SCMAD: Coding experience here is a little different. You won't be calling EJBs from here, but you can sure connect to some server and have it run business logic and return data to you.
-SCEA: Enterprise Architect. If this is your aim, you'd want to give yourself some experience developing software first. And if you've got some extra cash and exam study time to throw around, you may consider taking most of the other exams and cap it up with the SCEA.
-SCJA: You probably won't be needing this exam.
-NetBeans: I don't know about this one (now that Oracle's got SUN)... but then, your choice.

Also... you're not limited to SUN exams. You can also consider exams from Microsoft, Oracle, IBM, (I guess there used to be JBoss), etc. and a wide range of other technologies like DB, System Admin, XML, etc.
There are so many combination sets available. Just think about what your aims are (such as type of job you're interested in)... and follow that path. What I find is that people who work in small teams usually have a wide knowledge set (because they take several roles)... while those working in larger teams usually specialize in particular fields.

IMO... you should give yourself time to investigate other technologies... You may want to play with the Java EE tutorial. It's light and wide... and can help you decide on what you'd love to do next. No need to rush into another exam just yet.

...Hope this helps.
Yup. I agree with others...

for the certification... you really don't need to read up an EJB 2 book. You should just go straight ahead with an EJB 3 book (and EJB 3 in action is a really great book and it'll inform you a bit about how things were done in EJB 2).

..If however you find yourself needing to maintain or migrate some EJB 2 code, then reading an EJB 2 book like Head First EJBs is a wise choice (plus EJB 3 in Action's got an ok chapter on doing this).

My opinion though... Don't waist your time reading up EJB 2 (unless you really need to work with EJB 2).
It's understandable why SUN requires no prerequisites to the SCEA exam. But I think it's very important to for architects to get their hands dirty. I won't be surprised if Oracle would review this requirements when they get their hands on SUN certifications.

IMO.. you should give EJBs and other related J2EE technology some study and practice... save yourself some cash not writing the other exams and then go ahead with your SCEA. But its important you are very familiar with the complete J2EE stack to claim J2EE enterprise architect.

so in nutshell we can say that in case of @PersistenceUnit developer needs to worry about releasing the resources acquired by EntityManager and in case of @PersistenceContext container do this for us.



yes.. basically that. and you can explicity join a container-managed JTA transaction like this:



EntityManagers you get via @PersistenceContext are typically called Container Managed Entity Manager because the container manages things for you.
while EntityManagers you get via @PersistenceUnit / entityManagerFactory.createEntityManager() are called Application Managed Entity Manager because you'd have to manage certain things in your application code.
@PersistenceContext injects an instance of EntityManager (used for managing entities)
@PersistenceUnit injects an instance of EntityManagerFactory (used for creating EntityManagers)

...quite confusing when you first encounter them.
They both share the unitName parameter attribute.. which identifies the persistence unit. You'd typically use EntityManagerFactory only when you intend to manage the life-cycle of your EntityManagers... but generally, you're better of just injecting a container managed EntityManager using the @PersistenceContext




[corrected error: Thanks Niranjan, that was a copy and paste error. fixed it now]