Hello everyone, I just registered on this website, but feels like I have been a part of it for years (having referred to it and the numerous forums, among other interesting features and services, many many times). The wealth of experience of members of this website is mind-blowing!
Having said that, I have to confess I am struggling with a web app I am developing for the company I work for. Before I start, forgive me for any terms I use incorrectly - I am just learning this whole JPA/JTA/Hibernate persistence process. This web app is being developed using Eclipse Kepler SR1, JBoss EAP 6.2, JPA 2.1, Hibernate 3.5 (JTA) and Primefaces 3.5, with an Oracle database back-end.
The problem I am running into is with a selectOneMenu dropdown that is not getting populated with a list of countries from the database. When I load the web page the dropdown box is empty. Clicking on the dropdown arrow does nothing - no errors on the console, no activity (at least that I can see).
I am able to ping the database in the Database Development tool. Also, if I happen to misspell or enter an invalid column name next to a @Column annotation I get an error message indicating that no such column exists in the table. This leads me to believe there is a successful link with the database. However, I am sure there are multiple issues with either improper use of JPA, or with the whole persistence process in my code.
Here is my setup (please note that some information has been left out, for security reasons - if this poses a problem with getting help I will understand):
JSF (Please note that this is only the code for the dropdown box. Also, the ajax action is commented out for now - it isn't part of the problem, but is still "under construction" to be completed once this problem is resolved.):
Thank you for your time, and for being brave enough to review my code!!
As a rule, any code samples that won't fit on the screen all at once have a much lower chance of getting good answers. Since no one here gets paid, we don't have much incentive to strain our eyes or kill trees printing it out. So it's a good idea to start with abstract questions and provide specifics on demand. Might seem a bit slower, but more people will be paying attention and we don't get lost in the trees and fail to see the forest.
I did do a quick scan, and superficially stuff looks good, but that's all I can say on first glance.
If you're not getting the data from JPA, I'd recommend ignoring the JSF aspects of the app and concentrating on getting JPA working. JSF doesn't have any actual dependencies on JPA, so if it works without JSF, it will work with JSF.
What I do, in fact, is layer my JPA webapps. The persistence service and DAO classes I test offline using DBUnit (which is good for finding botched SQL/JPQL and other things that can only be validated at runtime).
Speaking of visual hardship, something seems wrong with the page editor this morning. The preceeding text should be multiple paragraphs, but preview shows it all lumped together. I may need to talk to someone about that.
Sources may include data from the Fakebook Research Foundation with support from Gargle University