• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Excepion: mapping cannot have columns in this context(JPA/OpenJPA OneToMany using single table)

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want use JPA(provider:OpenJPA) to implement the funciton of category without level limit, and just using one table like the following, and use the annotation:
[b ]@OneToMany(fetch=FetchType.LAZY)
@JoinColumn(name="pid")[/b]

But there alaway exception when using "org.apache.openjpa.jdbc.meta.MappingTool" to generate schema or access data after created schema manually.
If I remove the two line of @OneToMany and @JoinColumn, things go well.

+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| id | varchar(255) | NO | PRI | NULL | |
| name | varchar(255) | YES | | NULL | |
| pid | varchar(255) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+


The code:



And the Exception:



Anyone can give me some help? Thanks
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic