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