Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Gregory Shrago
Subsystem
J2EE.EJB3
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Frédéric Donckels
    3 years ago (03 Apr 2008 14:36)
  • Updated by   root
    2 years ago (17 Jan 2010 20:59)
  • Jira: IDEADEV-25799
    (history, comments)
 
IDEA-43456 Good code is red: @OrderBy annotation
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
The @OrderBy annotation is shown with red for "priority" in the following code, which is correct and works in hibernate:

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
public class Container {

//
instance fields

List<Content> content = new ArrayList<Content>();

private int id;

//
public methods

@OneToMany(targetEntity = Content.class)
@Cascade(CascadeType.ALL)
@JoinColumn(name = "CONTAINER_ID", nullable = false)
@OrderBy("priority ASC")
public List<Content> getContent() {
return content;
}

public void setContent(List<Content> content) {
this.content = content;
}

@Column(name = "ID", nullable = false)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}
}



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

@Entity
public class Content {

//
instance fields

int id;

int priority;

//
constructors

public Content(int priority) {
this.priority = priority;
}

public Content() {
}

//
public methods

@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO)
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public int getPriority() {
return priority;
}

public void setPriority(int priority) {
this.priority = priority;
}
}

Issue was resolved
Comments (0)
 
History
 
Linked Issues (?)
 
Issue has no comments