For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 2 replies, 1 voice, and was last updated 20 years, 1 month ago by
Lance Drake.
-
AuthorPosts
-
Lance DrakeMemberHi MyEclipse folks – there’s been WAY too much time lost on this one….
The persistent and pernicious error (from the system – in addition to the appearance of my exception string) reads:
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM employee t0_a WHERE (t0_a.employeeNumber = '12347')' at line 1The EJB JAVADOC reads:
/** * * @ejb.bean name="Employee" * display-name="Name for Employee" * description="Description for Employee" * type="CMP" * cmp-version="2.x" * local-jndi-name="ejb/EmployeeLocal" * view-type="local" * schema="Employee" * cmp-field="recnum" * cmp-field="employeeNumber" * cmp=field="employeeUserID" * cmp-field="employeeType" * cmp-field="employeeFirstName" * cmp-field="employeeLastName" * cmp-field="employeeInfo" * cmp-field="employeeGender" * cmp-field="employeeValid" * primkey-field="employeeNumber" * prim-key-class="java.lang.String" * * @ejb.pk class="java.lang.String" * generate="true" * * @ejb:util generate="physical" * * @ejb.finder * description="Get ALL Employee records" * signature="java.util.Collection findAll()" * query="SELECT OBJECT(a) FROM Employee AS a" * * @ejb.finder * description="Find by userID" * signature="java.util.Collection findByUserID(java.lang.String arg0)" * query="SELECT OBJECT(a) FROM Employee a WHERE a.employeeUserID = ?1" * * @ejb.finder * description="Find by employeeNumber" * signature="java.util.Collection findByEmployeeNumber(java.lang.String arg0)" * query="SELECT OBJECT(a) FROM Employee a WHERE a.employeeNumber = ?1" * */The inline code reads:
try { EmployeeLocalHome theEmployeeLocalHome = EmployeeUtil.getLocalHome(); Collection c = theEmployeeLocalHome.findByEmployeeNumber(employee); } catch { System.out.println("ERROR EmployeeAccess: FinderException for employeeNumber = "+employee+", ERR = "+fe.toString()); }I’ve tried changing the capitalization of EVERYTHING – including the MySQL database. The reason I mention it is because the given name of the Database Table is ‘Employee’ – but the error represents the name of the Table as ’employee’ – QUESTION: Is there ever an issue with capitalization and the names of Tables?
This approach works with other classes… what it IZZ with THIS one?
Thanks!
July 2, 2006 at 10:49 pm #254107
Lance DrakeMemberAlso – the EJB-JAR.xml file include…
<query> <description><![CDATA[Find by employeeNumber]]></description> <query-method> <method-name>findByEmployeeNumber</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[SELECT OBJECT(a) FROM Employee a WHERE a.employeeNumber = ?1]]></ejb-ql> </query>Thank you for sharing whatever secret-incantations I may have missed along the way that should allow this incredibly simple effort to succeed.
July 3, 2006 at 4:12 am #254115
Lance DrakeMemberOK… it’s only 3AM – but at least I don’t have to come up with an excuse as to why it is I cannot get past this problem.
Again – it was a self-inflicted gunshot wound to the foot that was at the bottom of all of this flapdoodle. I am posting so that, perhaps, somebody else will be able to promptly get past what had perplexed to me for such a long time.
The ‘SQL Syntax error’ was NOT based on something that I was passing incorrectly or had bungled in the EJB-JAR.xml representation or in the code, pser se.
The problem was that there was an extra field in my code-definition which did not match anything contained in the actual MySQL database table. The vague ‘SQL syntax’ complaint was but a red-herring leading me off of the trail as to what was REALLY wrong.
WHY the deployment engine did not complain about the table/field disconnect is a question – because it is so capable in generating OTHER complaints where even a single character is not properly capatalized – but, after I made ABSOLUTELY sure that everything matched, the queries started flying thru like eggs-over-easy orders in the Denny’s breakfast kitchen.
THANKS! – as I can now move onth the NEXT puzzlement!
-
AuthorPosts
