[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6295) @ElementCollection @Lob List<byte[]> fails

Evgeny Terentev (JIRA) noreply at atlassian.com
Mon Oct 3 12:30:19 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43945#comment-43945 ] 

Evgeny Terentev commented on HHH-6295:
--------------------------------------

i have this bug
on java 1.7 all ok

> @ElementCollection @Lob List<byte[]> fails
> ------------------------------------------
>
>                 Key: HHH-6295
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6295
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>    Affects Versions: 3.6.4
>            Reporter: Aleksei Valikov
>
> I am trying to map a List of {{byte[]}} as a @Lob @ElementCollection with no success.
> Below are test cases.
> Variant 1 (without targetClass):
> {code}
> @Entity
> public class G {
> 	private String id;
> 	@Id
> 	public String getId() {
> 		return id;
> 	}
> 	public void setId(String id) {
> 		this.id = id;
> 	}
> 	
> 	private List<byte[]> bytes;
> 	
> 	@ElementCollection
> 	@Lob
> 	public List<byte[]> getBytes() {
> 		return bytes;
> 	}
> 	
> 	public void setBytes(List<byte[]> bytes) {
> 		this.bytes = bytes;
> 	}
> 	
> }
> {code}
> Stack trace:
> {code}javax.persistence.PersistenceException: [PersistenceUnit: org.jvnet.hyperjaxb3.hibernate.tests.hhh] Unable to configure EntityManagerFactory
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:378)
> 	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
> 	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
> 	at org.jvnet.hyperjaxb3.hibernate.tests.hhh.EntityManagerFactoryTest.entityManagerFactoryCreated(EntityManagerFactoryTest.java:22)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity() defined: org.jvnet.hyperjaxb3.hibernate.tests.hhh.G.bytes
> 	at org.hibernate.cfg.annotations.CollectionBinder.getCollectionType(CollectionBinder.java:621)
> 	at org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:509)
> 	at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1979)
> 	at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:796)
> 	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:707)
> 	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:4035)
> 	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3989)
> 	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1398)
> 	at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
> 	at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1519)
> 	at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366)
> 	... 25 more
> {code}
> Variant 2 (with targetClass):
> {code}
> @Entity
> public class G {
> 	private String id;
> 	@Id
> 	public String getId() {
> 		return id;
> 	}
> 	public void setId(String id) {
> 		this.id = id;
> 	}
> 	
> 	private List<byte[]> bytes;
> 	
> 	@ElementCollection(targetClass=byte[].class)
> 	@Lob
> 	public List<byte[]> getBytes() {
> 		return bytes;
> 	}
> 	
> 	public void setBytes(List<byte[]> bytes) {
> 		this.bytes = bytes;
> 	}
> 	
> }{code}
> Stack trace:
> {code}
> org.hibernate.annotations.common.AssertionFailure: Fail to process type argument in a generic declaration. Member : org.jvnet.hyperjaxb3.hibernate.tests.hhh.G#getBytes Type: class sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl
> 	at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.getClassFromGenericArgument(AttributeFactory.java:846)
> 	at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:756)
> 	at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:731)
> 	at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:518)
> 	at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93)
> 	at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:187)
> 	at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:66)
> 	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
> 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
> 	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
> 	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list