-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Use of @OneToMany or @ManyToMany targeting an unmapped class
PostPosted: Mon Apr 05, 2010 6:31 am 
Newbie

Joined: Wed Mar 17, 2010 4:03 pm
Posts: 2
Hallo zusammen,

Hibernate: 3.3.2
Annotations: 3.4.0

ich erhalte folgende fehlermeldung: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.ganalin.mediathek.core.entity.security.Role.name.texts[com.ganalin.mediathek.core.entity.i18n.Text]

Alle Klassen sind in der config gemappt.

Hat jemand eine idee?

Danke und Gruss
Steff

hibernate.cfg.xml:
Code:
<mapping class="com.ganalin.mediathek.core.entity.i18n.Language" />
<mapping class="com.ganalin.mediathek.core.entity.i18n.Text" />
<mapping class="com.ganalin.mediathek.core.entity.i18n.Label" />
<mapping class="com.ganalin.mediathek.core.entity.security.Role" />
<mapping class="com.ganalin.mediathek.core.entity.security.User" />
<mapping class="com.ganalin.mediathek.core.entity.security.Client" />


Role.java
Code:
package com.ganalin.mediathek.core.entity.security;

import javax.persistence.Embeddable;
import javax.persistence.Entity;

import com.ganalin.mediathek.core.entity.BaseEntity;
import com.ganalin.mediathek.core.entity.i18n.Label;

@Entity
@Embeddable
public class Role extends BaseEntity {

   private static final long serialVersionUID = -3230114798846260223L;

   private Boolean systemEdit = null;
   private Boolean clientEdit = null;
   private Label name = null;

   public Boolean getSystemEdit() {
      return systemEdit;
   }

   public void setSystemEdit(Boolean systemEdit) {
      this.systemEdit = systemEdit;
   }

   public Boolean getClientEdit() {
      return clientEdit;
   }

   public void setClientEdit(Boolean clientEdit) {
      this.clientEdit = clientEdit;
   }

   public Label getName() {
      return name;
   }

   public void setName(Label name) {
      this.name = name;
   }
   
}


Label.java
Code:
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;

import com.ganalin.mediathek.core.entity.BaseEntity;

@Entity
@Embeddable
public class Label extends BaseEntity {

   private static final long serialVersionUID = 6642593836518829536L;

   @OneToMany(cascade = CascadeType.ALL)
   @Cascade( { org.hibernate.annotations.CascadeType.ALL })
   private List<Text> texts = null;

   public List<Text> getTexts() {
      return texts;
   }

   public void setTexts(List<Text> texts) {
      this.texts = texts;
   }

   public void addText(Text text) {
      if (texts == null) {
         texts = new ArrayList<Text>();
      }
      texts.add(text);
   }

   public void addText(Language language, String value) {
      Text text = new Text();
      text.setLanguage(language);
      text.setValue(value);
      addText(text);
   }

   public void removeText(Text text) {
      if (texts != null) {
         texts.remove(text);
         getDaoManager().getTextDao().deleteText(text);
      }
   }

   public void removeText(Language language) {
      if (texts != null) {
         for (Text text : texts) {
            if (text.getLanguage().equals(language)) {
               texts.remove(text);
               getDaoManager().getTextDao().deleteText(text);
            }
         }
      }
   }

   public Text getText(Language language) {
      if (texts == null) {
         return null;
      }
      for (Text text : texts) {
         if (text.getLanguage().equals(language)) {
            return text;
         }
      }
      return getDefaultText();
   }

   public Text getDefaultText() {
      if (texts == null) {
         return null;
      }
      for (Text text : texts) {
         if (text.getLanguage().getPreset()) {
            return text;
         }
      }
      return getAlternativeText();
   }

   public Text getAlternativeText() {
      if (texts == null) {
         return null;
      }
      return texts.get(0);
   }

   public String getTextValue(Language language) {
      Text text = getText(language);
      if (text == null) {
         return null;
      }
      return text.getValue();
   }

   public String getDefaultTextValue() {
      Text text = getDefaultText();
      if (text == null) {
         return null;
      }
      return text.getValue();
   }

   public String getAlternativeTextValue() {
      Text text = getAlternativeText();
      if (text == null) {
         return null;
      }
      return text.getValue();
   }

}


Text.java
Code:
package com.ganalin.mediathek.core.entity.i18n;

import javax.persistence.CascadeType;
import javax.persistence.OneToMany;

import com.ganalin.mediathek.core.entity.BaseEntity;

public class Text extends BaseEntity {

   private static final long serialVersionUID = 704944140234128282L;

   @OneToMany(cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
   private Language language = null;
   private String value = null;

   public Language getLanguage() {
      return language;
   }

   public void setLanguage(Language language) {
      this.language = language;
   }

   public String getValue() {
      return value;
   }

   public void setValue(String value) {
      this.value = value;
   }

}


Language.java
Code:
package com.ganalin.mediathek.core.entity.i18n;

import javax.persistence.Embeddable;
import javax.persistence.Entity;

import com.ganalin.mediathek.core.entity.BaseEntity;

@Entity
@Embeddable
public class Language extends BaseEntity {

   private static final long serialVersionUID = 5400373671078501681L;

   private String name = null;
   private String iso = null;
   private Boolean preset = null;

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public String getIso() {
      return iso;
   }

   public void setIso(String iso) {
      this.iso = iso;
   }

   public Boolean getPreset() {
      return preset;
   }

   public void setPreset(Boolean preset) {
      this.preset = preset;
   }

}


Top
 Profile  
 
 Post subject: Re: Use of @OneToMany or @ManyToMany targeting an unmapped class
PostPosted: Mon Apr 05, 2010 7:52 am 
Newbie

Joined: Wed Mar 17, 2010 4:03 pm
Posts: 2
Konnte es selber lösen. Ich Dummbatz hab @Entity vergessen ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.