Anthony Watson

Ranch Hand
+ Follow
since Sep 25, 2003
Merit badge: grant badges
For More
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 Anthony Watson

I noticed that the ibiblio maven2 repository site not only has third party jar files, but also .pom files for those jars that help with transitive dependencies. I am new to Maven. I have created pom.xml files for my modules but I am unsure how to create the .pom files for my module artifacts (e.g. jars, wars). Are the .pom files generated or maintained manually and separately from the pom.xml file dependencies? If they are generated, what plugin and goal should I run to generate them? Thanks a bunch in advance.
17 years ago
I have recently written a custom primary key generator implementation. The implementation requires that you provide a context for a new key request. For example, if I want to get a new key for an insert into a table called Contacts, my context is Contacts. I would like for my key generator implementation to be able to determine at runtime what table the insert statement will go against. I want to use this table name as the context. Currently, I have clients configure the context as a parameter for my key generator implementation in the Hibernate mapping file. I would rather have my code get the table name and not require clients to configure it.

Does anyone know how to programatically get the table name from the Hibernate API if you start with a reference to either org.hibernate.engine.SessionImplementor or to the domain object that is to be peristed?
You're right. I meant to put it there but I must have clicked the wrong link.
18 years ago
There is a site called that takes a webpage and translates it into things that a gangsta rapper would say. The translations for javaranch are hilarious. Try it out, but be warned, gizoogle throws a curse word or two in there sometimes. Please post feedback if you thought it was funny.

Here's a sample

What was:

No cows were harmed in the making of Rules Roundup.


No cows wizzy harmed in tha pimpin' of Rules Roundup.
18 years ago
I want to have an internationalized String that takes the following format:

Returned results for "PLACEHOLDER" in:

where PLACEHOLDER is something dynamic that is returned from a data store and is already internationalized.

I was thinking that I could have two keys in a properties file:

1) returned=Returned results for
2) returned.part.two=in:

The problem is that I know that word order can vary in different languages (English, Spanish, etc) and that it would be difficult for a translator to get the word order correct for a String that is made up of multiple parts.

How are people doing this? Please help. Thanks.
18 years ago
I did end up writing my own and it is very simple. SMTPAppender uses JavaMail APIs behind the scenes. I just found where SMTPHost was being set in the SMTPAppender and then added getter/setter methods for smtpPort and the following:

if (smtpPort != null) {
props.put("mail.smtp.port", smtpPort);

Session session = Session.getInstance(props, null);
I've been trying to figure out a way that I can configure log4J to send error emails. The problem is that our admins require me to use a non-default port to connect to the SMTP server. Log4J's SMTPAppender does not seem to be able to handle any port other than 25. Does anyone have any suggestions? Is there another implementation of an SMTPAppender available that I can use that allows the port to be specified? Thanks so much. Below is the configuration I have so far:

<appender name="SMTP" class="">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Threshold" value="ERROR"/>
<param name="To" value=""/>
<param name="From" value=""/>
<param name="Subject" value="JBoss Sever Errors"/>
<param name="SMTPHost" value=""/>
<param name="BufferSize" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
[ January 25, 2006: Message edited by: Anthony Watson ]
For the below xml schema section, is there any way to say that the 'remote-ejb-home' element is required ONLY if the 'ejb-version' element is present?

<xs:element name="object">
<xs:element ref="ejb-version" minOccurs="0" maxOccurs="1" />
<xs:element ref="remote-ejb-home" minOccurs="0" maxOccurs="1" />
<xs:element ref="jndi-name" minOccurs="0" maxOccurs="1" />
<xs:element ref="context-name" minOccurs="0" maxOccurs="1" />

Thanks a lot in advance
Say an EJB has a method getResponseDTO() that returns an interface type, IResponseDTO. The method is called by a remote client. When the client gets the result, how does it know how to deserialize the IResponseDTO? There must be something in the serialized object that indicates what implementation the IResponseDTO should be implemented by, right? So that means that the remote client will need a version of implementation class that is in synch with the EJB server's version, right?
18 years ago
In a struts application that uses Tiles, what is the best way to ensure that all pages use the UTF-8 charset? If there's a good way that doesn't require the Struts framework, that would be better. Thanks.
[ August 17, 2005: Message edited by: Anthony Watson ]
18 years ago
I guess JSTL 1.1 is only compatible with J2EE 1.4?
18 years ago
(My company has a J2EE 1.3 container)

I was looking at Sun's JSTL download page, and I saw that you can't actually download a jstl.jar. They make you either download j2ee or the web services developer's pack. I downloaded the developer's pack and found the jstl.jar after installing it.

Is there any problem using this jstl.jar? Should I use the jstl implementation from Jakarta instead?
18 years ago
Scenario: a stateless session bean method (using container managed transactions) calls an update method on a DAO. The DAO calls a stored procedure that fails and a SQLException is thrown in the DAO. The DAO wraps the SQLException as a checked Exception called MyBusinessException. The stateless session bean method catches MyBusinessException, logs it, and returns (without ever calling setRollbackOnly() ).

In this scenario, won't the EJB container try to commit a transaction for a stored procedure that failed?
If your code synchronizes on an object (myObject) and, at the time you are writing the code, there is currently no thread that calls myObject.wait(), is it still good programming practice to put notifyAll() at the end of all your synchronized blocks in anticipation of future code calling myObject.wait() ?
when you have code like this:

does this implicitly add the currently executing thread to the list of threads that should be informed when another thread calls myObject.notifyAll()?

I'm pretty sure that there is no implicit wait, but if not, shouldn't there be?