• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

ping zhang
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)

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
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!