Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
ping zhang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic