Davide Crudo

Ranch Hand
+ Follow
since Sep 08, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Davide Crudo

Did you put all your dependencies (jar files) in the classpath?

are you using an IDE?
10 years ago
Hi,

i think the best would be not to hardcode everything with if...else statement.

The best would be to use a Database (either a file, mysql, or hypersonic).

In the DB you need to store every combination, like:


so that your code, will check each time some keys are typed, if that sequence is possible.

Imagine the following:

when you type the first ᄒ char, it will look it up in the DB for possible matches.
when you insert the second...then the third, matches will be less and less.

You can do everything with a couple of classes...and no need for if/then/else loops...

Dave
10 years ago
Sorry, my bad. The setParameterList seems not to be available in the EntityManager,
you could use hibernate in your Bean:

The setParameterList is available, but in the Hibernate Query (instead of the javax.Persistence package).

You would then need to get the SessionFactory injected and retrieve the hibernate session:


I would recommend using the @Startup annotation.
Of course it will run on each server restart, but you
could use it to do some other checks or things...



You can try the following:



Next time...could you put your code inside "Code" tags?...
it would make it more readable ;)

Regards
Dave
@Stateless(name="manager")

is a friendly name. Imagine you have the following:



you can just refer to the bean with "manager" instead of the full class name.


mappedName as you stated is vendor specific. So its behaviour depends on the container you will be using.
in Glassfish is used to assign a global name in JNDI

for beanName you can check this thread (i've never used it myself):

Thread Link

You use the Lookup when you need to locate a bean looking in the context.

For instance, check the section related to the RMI (Calling an EJB remotely). In which case you will need
to ask the remote server to look into the context and find your bean.

Normally, when working on the local server with local beans, I don't ask the context to find beans ,
i just inject them and let EJB taking care of finding them.

Regards
Dave
I have the feeling that your timers overlap and autocancel, more specifically:



i would try to change it into:



I think the timer is Scheduled for "now" then it runs and finds another timer running and it will cancel it.

As mentioned earlier, is better you name your timers so that you know which one you are cancelling, otherwise
with your code you are cancelling All timers and it will prevent you from using other timers efficiently. (to name
a timer, just change the 'null' field into a string or something)

I've prepared an example you can try out. This will cancel the current timer and re-create a new one each time:


Hi,

As a general rule, i don't think is a good idea to control the Pool size of the timers. The pool size is automatically managed
by the container.

From your code, i can see you cancel the timer but where do you re-create it?

could you post the complete @Timeout method?

Dave

aanshu gupta wrote:Hi,
I have a requirement where in we need to create a timer which runs every 5 mins(default). This works fine and our operation runs fine every 5 mins.
The problem is we need to change this time duration based on user choice and this is what creates the problem.
We have tried stopping the timer by timer.cancel() and restarting it with the new passed time interval but this does not work.

Anyone having worked on similar requirements/ knows the workaround?
Please help.
Thanks



Remember that timers will survive the server restart...are you sure you didn't schedule multiple timers? It sounds like you cancelled one timer
but probably all other timers are still active.

How do you cancel the timer? do you assign a different name to each one of them?

If you want to quick start, i would suggest the following:

- Get JBoss Developer Studio from Redhat (version 4.0)

it contains:

- Jboss Application Server
- Development IDE (Based on Eclipse)

the nice thing is that after installing it, everything is ready to go. no need to waste time understanding
how to integrate or pack your application and deploy it from the beginning. The more you will learn
the more you'll understand how to do things on the side.

Regards
Dave

Dear All,

I'm struggling with an issue with Ajax and JSF and i cannot figure it out... I've tried to find
anything on various sites...but no idea on this behaviour.

I would like to validate a user creation on the fly: if the user already exists, return an error.

I cmanaged to have it working with this code:



if, howewer, I change line 25 into the following:



the validation of the user (if exists) is not performed (no ajax call...)

As i'm new to ajax, I cannot figure out what the problem is.

What i'm trying to do is to perform two checks:

- If the user exists
- If the field is empty, return an error

any idea why adding required="true" will prevent the user background check?

Thank you in advance!

Dave
11 years ago
JSF
Hi,

I'm trying to get the Jboss seam examples working with the WAR format...but when using Statefull seam components i always
get a "Component not Bound Exception"...

It works fine when I use the EAR packaging...

The reason i was trying to work with WAR is that the hot deploy seems to work fine with stateless beans... and I don't need to restart
the server each time... I couldn't find a way to hot deploy with EAR files...

Any hint on helping me out would be great!
Thanks a lot!
Dave
11 years ago
Hi,

thanks for your reply...

i've never used web services before...but if i understand right, I cannot pass objects
back and forth with webservices...is more like a request response...or am I wrong?

I would like to be able to pass objects...which is more practical ...

any idea?
thanks...
Dave
11 years ago
Hi !

I'm trying to create a remote application on Android, connecting to a Jboss server...

What i want to do is to use javax.remote features, and access Objects on the Jboss server.

The problem is that when i Run my application in the simulator, the app crashes...i'm using the following imports:



I think the problem is that maybe Android doesn't have the javax libraries installed...

Anyone can point me to the right direction?
Thank you in advance!

Dave
11 years ago