• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Corrections for xmlMapping example in chapter 13

 
Bartender
Posts: 2453
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)


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic