org.hibernate.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GitHub comment 7#134672301
    via GitHub by hareluya86
    ,
  • I have a custom class, that represents an ip network and operations on it: public class IpNetwork implements Comparable<IpNetwork> { private final BigInteger address; private final short bitmask; /* other stuff skipped */ } And i would like to store it into the pgsql database, using proprietary pgsql inet type, so i wrote my own UserType implementation: public class IpNetworkMapping implements UserType { public int[] sqlTypes() {return Types.OTHER;} public Class returnedClass() { return IpNetwork.class;} /** Implementation details skipped */ } Now i'm able to use it in my entity classes, like that: @TypeDef( name = "IpNetworkType", defaultForType = IpNetwork.class, typeClass = IpNetworkMapping.class ) @Entity @Table(name="ip_networks") public class Network extends AbstractIdentifiableObject { @Column(name = "net") @Type(type = "IpNetworkType") private IpNetwork network; /** Other fields skipped */ } And it works just fine in hibernate versions up to 4.3.5.Final, but 4.3.6.Final and 4.3.7.Final throw exception on initialization: [2014-11-05T10:32:18.207+0200] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=49 _ThreadName=admin-listener(5)] [timeMillis: 1415176338207] [levelValue: 1000] [[ Exception while preparing the app : [PersistenceUnit: entityManagerFactory] Unable to build Hibernate SessionFactory org.hibernate.MappingException: Could not determine type for: com.satgate.IpConf.type.hibernate.IpNetworkMapping, at table: ip_networks, for columns: [org.hibernate.mapping.Column(net)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) at org.hibernate.mapping.Property.isValid(Property.java:241) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199) at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) [...rest of call stack skipped...]
    via by Denis Chapligin,
  • GitHub comment 21#52621705
    via GitHub by ceefour
    ,
  • I have a custom class, that represents an ip network and operations on it: public class IpNetwork implements Comparable<IpNetwork> { private final BigInteger address; private final short bitmask; /* other stuff skipped */ } And i would like to store it into the pgsql database, using proprietary pgsql inet type, so i wrote my own UserType implementation: public class IpNetworkMapping implements UserType { public int[] sqlTypes() {return Types.OTHER;} public Class returnedClass() { return IpNetwork.class;} /** Implementation details skipped */ } Now i'm able to use it in my entity classes, like that: @TypeDef( name = "IpNetworkType", defaultForType = IpNetwork.class, typeClass = IpNetworkMapping.class ) @Entity @Table(name="ip_networks") public class Network extends AbstractIdentifiableObject { @Column(name = "net") @Type(type = "IpNetworkType") private IpNetwork network; /** Other fields skipped */ } And it works just fine in hibernate versions up to 4.3.5.Final, but 4.3.6.Final and 4.3.7.Final throw exception on initialization: [2014-11-05T10:32:18.207+0200] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=49 _ThreadName=admin-listener(5)] [timeMillis: 1415176338207] [levelValue: 1000] [[ Exception while preparing the app : [PersistenceUnit: entityManagerFactory] Unable to build Hibernate SessionFactory org.hibernate.MappingException: Could not determine type for: com.satgate.IpConf.type.hibernate.IpNetworkMapping, at table: ip_networks, for columns: [org.hibernate.mapping.Column(net)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) at org.hibernate.mapping.Property.isValid(Property.java:241) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199) at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) [...rest of call stack skipped...]
    via by Denis Chapligin,
    • org.hibernate.MappingException: Could not instantiate id generator [entity-name=eds.entity.data.EnterpriseObject] at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123) at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:213) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:323) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)

    Users with the same issue

    Unknown visitor1 times, last one,
    nasimk
    4 times, last one,
    kuldeep
    16 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    35 more bugmates