Is there some way for a JavaEE application to get it's DataSource without knowing it's JNDI name if application has a single datasource?
I want to decouple application from the name of it's DataSource to avoid hardcoding JNDI name of the DataSource in the code (no matter in @Resource(name="")
or in code that works with Contexts). Should i do this at all or it's normal practice to hardcode JNDI name of the datasource because coupling of DataSource with JDBC connection pool is described in web.xml and this gives all necessary flexibility?
Thanks in advance.