Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.hibernate.annotations.Entity ignored by AnnotationSessionFactoryBean [SPR-5787] #10457

Closed
spring-projects-issues opened this issue May 26, 2009 · 4 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Iwein Fuld opened SPR-5787 and commented

Based on a question from a student I tried to replace javax.persistence.Entity with org.hibernate.annotations.Entity, and found that it wasn't being picked up by the AnnotationSessionFactoryBean. Since it is documented as an extension of j.p.Entity this seems rightfully unexpected, so it would be nice if it was picked up.


Affects: 2.5.6

Referenced from: commits a5c324f

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good point, we need to check for that one explicitly, assuming that a class may be annotated with that special Hibernate entity annotation but no standard JPA stereotype...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

adrian marti commented

This still seems broken to me using Spring nightly 3.0.0.CI-325 (7/11/2009). Beans marked as org.hibernate.annotations.Entity are still not mapped, while simply switching them to javax.persistence.Entity fixes the issue.

@spring-projects-issues
Copy link
Collaborator Author

Ganesh Krishnan commented

This bug has been shown as resolved but I seem to have hit upon this in my project. I have marked the Hibernate entity with @javax.persistence.Entity annotation and still the spring build is not picking it up. Running the project throws up the exception

org.hibernate.hql.ast.QuerySyntaxException: CountryDetail is not mapped [from CountryDetail]

where CountryDetail has been annotated with @Entity.

-------------8-<------- snip ------

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class CountryDetail extends BaseObject{
private static final long serialVersionUID = 1L;
...
}

-------------8-<------- snip ------

The only workaround seems to be manually defining the entity in the hbm file.

@spring-projects-issues
Copy link
Collaborator Author

Iwein Fuld commented

This was in fact fixed: https://fisheye.springsource.org/browse/spring-framework/trunk/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java?r2=1276&r1=348

I don't have my test code anymore, but I didn't encounter this bug after the fix. In particular the fact that you mention having this problem with j.p.Entity makes me suspicious that something else is amiss in your situation. In other words, the CountryDetail class that you showed a snippet from can not suffer from this bug.

@spring-projects-issues spring-projects-issues added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 M4 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants