[Hibernate-JIRA] Created: (HHH-6632) Improve exception message when package-info / other file is missing @ metadatasources.buildMetadata()
by Elmer van Chastelet (JIRA)
Improve exception message when package-info / other file is missing @ metadatasources.buildMetadata()
-----------------------------------------------------------------------------------------------------
Key: HHH-6632
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6632
Project: Hibernate Core
Issue Type: Improvement
Components: metamodel
Affects Versions: 4.0.0.CR2
Reporter: Elmer van Chastelet
While migrating our project to the new Hibernate Core 4.0, I came across an exception which was thrown during metadatasources.buildMetadata(). Emmanuel helped me to find the cause, which were the missing package-info.java files for the packages I add to the MetadataSources object. If possible, improve this exception message to include info about the file that fails to load.
{code}
Sep 5, 2011 4:17:46 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet mainservlet
java.io.IOException: Stream closed
at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:151)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at java.io.DataInputStream.readFully(DataInputStream.java:195)
at java.io.DataInputStream.readFully(DataInputStream.java:169)
at org.jboss.jandex.Indexer.verifyMagic(Indexer.java:387)
at org.jboss.jandex.Indexer.index(Indexer.java:628)
at org.hibernate.metamodel.source.annotations.AnnotationMetadataSourceProcessorImpl.indexClass(AnnotationMetadataSourceProcessorImpl.java:159)
at org.hibernate.metamodel.source.annotations.AnnotationMetadataSourceProcessorImpl.prepare(AnnotationMetadataSourceProcessorImpl.java:85)
at org.hibernate.metamodel.source.internal.MetadataImpl.prepare(MetadataImpl.java:180)
at org.hibernate.metamodel.source.internal.MetadataImpl.<init>(MetadataImpl.java:165)
at org.hibernate.metamodel.source.internal.MetadataBuilderImpl.buildMetadata(MetadataBuilderImpl.java:83)
at org.hibernate.metamodel.MetadataSources.buildMetadata(MetadataSources.java:112)
at utils.HibernateUtilConfigured.<clinit>(HibernateUtilConfigured.java:60)
at utils.DispatchServlet.tryLoadGlobalsAndPerformInit(DispatchServlet.java:19)
at utils.DispatchServlet.init(DispatchServlet.java:39)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:679)
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[Hibernate-JIRA] Created: (HHH-6351) Enum Bug when using OK word inside of a enum being retrieved
by Lucas Arruda (JIRA)
Enum Bug when using OK word inside of a enum being retrieved
------------------------------------------------------------
Key: HHH-6351
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6351
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.6.5, 3.3.0.GA
Environment: Hibernate version 3.3.0.GA, 3.6.5.Final with hibernate-annotations 3.4.0.GA. Oracle database.
Reporter: Lucas Arruda
Priority: Minor
I have a class with a field which is an enum, which is mapped by a enum called Status.
The class is described (simplified and without all annotations) above:
public class A {
private Status status;
public enum Status { OK, NOK, NAP }
@Column(name = "STATUS")
@Enumerated(EnumType.STRING)
public Status getStatus() {
return status;
}
...
}
The thing is. I can store a record from A with status = 'OK', 'NOK' or 'NAP' perfectly. But, when I try to retrieve that record, if status = 'NOK' or 'NAP' it works correctly, but no with status = 'OK', which gives me an exception:
java.lang.IllegalArgumentException: Unknown name value for enum class com.a.b.c.d.A$Status: OK
at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:113)
...
Caused by: java.lang.IllegalArgumentException: No enum const class com.a.b.c.d.A$Status.OK
at java.lang.Enum.valueOf(Enum.java:196)
at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:110)
Reported a StackOverflow [1] and now one could solve this using 'OK' in the Enum.
What I did to solve this, since I couldn't get I done with OK, was to change a little bit the enum with this, which works correctly:
public enum Status {
_OK("OK"),
NOK("NOK"),
NAP("NAP");
private String desc;
public String getDesc() {
return desc;
}
private Status(String desc) {
this.desc = desc;
}
}
Since I couldn't make it work with 'OK', I highly suspect it's either a big mistake by my part or a bug, so I'm reporting it.
[1] http://stackoverflow.com/questions/6432933/hibernate-jpa-bug-not-recogniz...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[Hibernate-JIRA] Created: (HHH-3724) Bug in determining the getter method for property
by Senthil (JIRA)
Bug in determining the getter method for property
--------------------------------------------------
Key: HHH-3724
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3724
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: hibernate-core-3.3.1.GA.jar, Oracle Express Edition 10g
Reporter: Senthil
Priority: Minor
I have an entity class with a property "String nextOnError" mapping to the database column "varchar nextOnError". I have a getter method "String getNextOnError()" defined in the class. But I also have another method "boolean isNextOnError()" for my other processing in the application. I was expecting hibernate would pick the getter method "String getNextOnError()" as the getter method but it is not. It is always picking the "boolean isNextOnError()" and resulting in "Class cast exception: java.lang.Boolean" during insertion. This is because, for each property, in the class "org.hibernate.property.BasicPropertyAccessor", the method "getterMethod(Class theClass, String propertyName)" is looping through all the getter methods with no arguments. The loop breaks when it finds any method starts with either "isNextOnError()" or "getNextOnError()". Unfortunately, in my case, it always ends up with "boolean isNextOnError()". I think the correct way is to check all the methods for starting with get... and if nothing is found, then start looking for method starting with 'is...' .
Thanks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[Hibernate-JIRA] Created: (HHH-4504) Query on polyphomic association
by Rafael Santini (JIRA)
Query on polyphomic association
-------------------------------
Key: HHH-4504
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4504
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: MySQL 5.0.51a-community-nt
Reporter: Rafael Santini
The following query on a polyphormic association does not works:
from Pessoa where nome = 'Rafael';
Error: Unknown column 'pessoa1_1_.nome' in 'where clause'
Mapping:
<class name="Pessoa" table="bs_com_pessoa">
<id name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<joined-subclass name="PessoaFisica" table="bs_com_pessoa_fisica">
<key column="id_pessoa"/>
<property column="nome" name="nome" not-null="true"/>
</joined-subclass>
<joined-subclass name="PessoaJuridica" table="bs_com_pessoa_juridica">
<key column="id_pessoa"/>
<property name="razaoSocial" column="razao_social" not-null="true"/>
<property name="nomeFantasia" column="nome_fantasia" not-null="true"/>
</joined-subclass>
</class>
<class name="Cliente" table="bs_erp_cliente">
<id name="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<many-to-one name="pessoa" class="Pessoa" column="id_pessoa" not-null="true" unique="true" cascade="all"/>
</class>
SQL generated by Hibernate:
select cliente0_.id as id18_, cliente0_.id_pessoa as id2_18_ from bs_erp_cliente cliente0_, bs_com_pessoa pessoa1_ where cliente0_.id_pessoa=pessoa1_.id and (pessoa1_1_.nome like ?) order by pessoa1_1_.nome
There is not pessoa1_1_ in the from clause.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months