[
http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-50?page...
]
Stephan Bublava commented on METAGEN-50:
----------------------------------------
{quote}How can a @Deprecated annotation create a problem/warning which needs suppressing
in the metamodel?{quote}
We have set "Deprecated API" to "Warning" in Eclipse (Preferences
-> Java -> Compiler -> Errors / Warnings), which triggers Eclipse warnings for
all references to deprectated constructs.
If Foo.java is deprecated then Eclipse will warn about all attribute definitions in
Foo_.java
{quote}Can you provide a testcase/example?{quote}
Here's a simplified example:
{noformat}
@Entity
public class TShirt {
public enum Color {
RED, GREEN, BLUE
};
@Id
@Column(name = "id")
public Long id;
@Type(type = "bitset", parameters = @Parameter(name = "enumClass",
value = "TShirt$Color"))
@Column(name = "colors")
public EnumSet<Color> colors;
}
{noformat}
The custom type uses the binary representation of the column value for mapping; for
example: 5 => 2^0 + 2^2 => {0, 2} => {RED, BLUE}. I've omitted the actual
implementation, because it doesn't influence the meta-model, which looks like this:
{noformat}
@StaticMetamodel(TShirt.class)
public abstract class TShirt_ {
public static volatile SingularAttribute<TShirt, Long> id;
public static volatile SingularAttribute<TShirt, EnumSet> colors;
}
{noformat}
Since it contains EnumSet instead of EnumSet<Color>, there are Eclipse warnings as
well (with the settings we are using).
Suppress Warnings
-----------------
Key: METAGEN-50
URL:
http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-50
Project: Hibernate Metamodel Generator
Issue Type: Improvement
Components: processor
Affects Versions: 1.1.1.Final
Reporter: Stephan Bublava
Assignee: Hardy Ferentschik
Priority: Minor
Please consider adding a @SuppressWarnings("all") annotation to the generated
classes. Warnings in generated code are not helpful.
In my case the warnings (driven by IDE settings) are caused by:
1) Entities marked as @Deprecated.
2) A custom Hibernate user type that maps a numeric SQL type into an EnumSet<T>.
The generated SingularAttribute does not preserve the type of the set.
--
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