org.hibernate.MappingException:无法确定以下类型:

时间:2014-04-06 07:32:57

标签: java hibernate

    @Embeddable
    public class WeaverPagarDetails{
    @JoinColumn(name = "qualityId")
            private FabricQualityDetailsForm quality;
            private int totalTaka;
            private double totalMeters;
            private double ratePerTaka;
            private double pagarAmount;

    public FabricQualityDetailsForm getQuality() {
           return quality;
    }

    public void setQuality(FabricQualityDetailsForm quality) {
           this.quality = quality;
    }

...

    @Entity
    @Table (name="WEAVER_PAGAR")
    public class WeeklyWeaverPagarForm {

       @Id @GeneratedValue(strategy = GenerationType.AUTO)
private int pagarId;
@Temporal(javax.persistence.TemporalType.DATE)
private Date fromDate;
@Temporal(javax.persistence.TemporalType.DATE)
private Date toDate;

@OneToOne
@JoinColumn(name = "weaverId")
private WeaverDetailsForm weaver;

@ElementCollection
@JoinTable(name="TAKA_DETAILS")
@GenericGenerator(name="hilo.gen" ,strategy="hilo")
@CollectionId(columns={@Column(name="ID")},generator="hilo.gen", type=@Type(type="long"))
private Collection<WeaverPagarDetails> takaDetails = new ArrayList();

... ..

我得到的错误是:

org.hibernate.MappingException: Could not determine type for: textileautomate.java.form.FabricQualityDetailsForm, at table: TAKA_DETAILS, for columns: [org.hibernate.mapping.Column(quality)]
    at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:314)
    at org.hibernate.tuple.PropertyFactory.buildStandardProperty(PropertyFactory.java:240)
    at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:70)
    at org.hibernate.mapping.Component.getType(Component.java:172)
    at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:292)
    at org.hibernate.mapping.Collection.validate(Collection.java:313)
    at org.hibernate.mapping.IdentifierCollection.validate(IdentifierCollection.java:68)
    at org.hibernate.cfg.Configuration.validate(Configuration.java:1331)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1789)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1868)
    at textileautomate.java.actions.SessionFactoryGen.getInstance(SessionFactoryGen.java:25)
    at textileautomate.java.actions.WeaverActions.<init>(WeaverActions.java:29)
    at textileautomate.java.begin.TextileFrame.initCompData(TextileFrame.java:73)
    at textileautomate.java.begin.TextileFrame.<init>(TextileFrame.java:43)
    at textileautomate.java.begin.TextileFrame$19.run(TextileFrame.java:1392)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

我是hibernate的新手,我想知道是否可以在@Embeddable类中使用注释@JoinColumn。

0 个答案:

没有答案