• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Corrections for xmlMapping example in chapter 13

 
Bartender
Posts: 2442
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For everyone's reference, on p.407 of JPA Pro , xmlmapping,


The corresponding orm.xml is:


My correction is:

The corresponding orm.xml is:


If I don't specify CITY  in the attribute override, the Employee.findAll query cannot find t0.City from EMP class.
The exception is:


Call: SELECT t0.ID, t0.TYPE, t1.EMP_ID, t0.NAME, t0.STARTDATE, t0.CITY, t1.PROV, t0.STREET, t1.PCODE, t0.DEPT, t0.MGR, t0.DAILYRATE, t0.TERM, t0.HOURLYRATE, t0.VACATION, t0.PENSION, t0.SALARY FROM xmlMappings.EMP t0, xmlMappings.EMP_ADDRESS t1 WHERE (t1.EMP_ID = t0.ID)
Query: ReadAllQuery(name="Employee.findAll" referenceClass=Employee sql="SELECT t0.ID, t0.TYPE, t1.EMP_ID, t0.NAME, t0.STARTDATE, t0.CITY, t1.PROV, t0.STREET, t1.PCODE, t0.DEPT, t0.MGR, t0.DAILYRATE, t0.TERM, t0.HOURLYRATE, t0.VACATION, t0.PENSION, t0.SALARY FROM xmlMappings.EMP t0, xmlMappings.EMP_ADDRESS t1 WHERE (t1.EMP_ID = t0.ID)")

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 't0.CITY' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic