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

No metadata was found for type "class java.util.ArrayList". The class is not enhanced

 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i'm trying to use openJPA

i'm having an account which contains many roles. in my domain entity i declared the list of roles as Colletion<Role> roles = new ArrayList.

now as i'm trying to persitate my objects, i'm getting an exception:

Exception in thread "main" <openjpa-1.0.1-r420667:592145 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: No metadata was found for type "class java.util.ArrayList". The class is not enhanced.
at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:292)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:237)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3159)
at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
at com.xxx.xxx.solutionmanger.userhandling.persistency.PersistencyManager.saveUserRegistration(PersistencyManager.java:29)
at com.xxx.xxx.solutionmanger.userhandling.persistency.Main.main(Main.java:45)


does anybody know how i can enhance this class?

thanks!

[ January 25, 2008: Message edited by: Chrigi Pfister ]
[ January 25, 2008: Message edited by: Chrigi Pfister ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the question comes down to, how are you mapping this relationship? Please post your mapping, that will help us figure out why you are getting the error. You don't need to do anything to the J2SE classes.

Mark
 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my SQL-database:

CREATE TABLE ROLE (
roleId INT( 12 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
roleDescription VARCHAR(255),
shortDescription VARCHAR(255));

CREATE TABLE ACCOUNT_ROLES(
roleId INT ( 12 ),
accountId INT ( 12 ));

CREATE TABLE ACCOUNT (
accountId INT( 12 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
roleFk INT ( 12 ),
username VARCHAR(255),
password VARCHAR(255),
confirmPassword VARCHAR(255));

now i'm not quite sure but do i need an entity for each table in the DB? 'cause i'm trying to map 2 objects (account and role) to these 3 tables. account contains an arraylist of roles.


class Account:
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="ACCOUNT_ROLES",
joinColumns=@JoinColumn(name="accountId", referencedColumnName = "accountId"),
inverseJoinColumns=@JoinColumn(name="roleId", referencedColumnName = "roleId"))

private ArrayList<Role> role;

class Role:
@ManyToMany(mappedBy="role")
private ArrayList<Account> account;


thanks for any help!
[ January 29, 2008: Message edited by: Chrigi Pfister ]
 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there anybody who could help me on this?

thanks folks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic