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

spring data rest and jpa repository #39823

Closed
phamquangvinhfpt opened this issue Mar 4, 2024 · 1 comment
Closed

spring data rest and jpa repository #39823

phamquangvinhfpt opened this issue Mar 4, 2024 · 1 comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid

Comments

@phamquangvinhfpt
Copy link

phamquangvinhfpt commented Mar 4, 2024

I get a case like this:

@Data
@Entity
@Table(name = "course")
public class Course {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int Id;
    @Column(name = "course_name", length = 50)
    private String CourseName;
    @Column(name = "description", columnDefinition = "TEXT")
    private String Description;
    @Column(name = "price")
    private double Price;
    @Column(name = "amount")
    private int Amount;

    //Relationship
    @ManyToMany(fetch = FetchType.LAZY, cascade = {
            CascadeType.PERSIST, CascadeType.MERGE,
            CascadeType.DETACH, CascadeType.REFRESH
    })
    @JoinTable(
            name = "course_category",
            joinColumns = @JoinColumn(name = "course_id"),
            inverseJoinColumns = @JoinColumn(name = "category_id")
    )
    @JsonIgnore
    List<Category> Categories;
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "Course", cascade = {
            CascadeType.PERSIST, CascadeType.MERGE,
            CascadeType.DETACH, CascadeType.REFRESH
    })
    @JsonIgnore
    private List<OrderDetail> OrderDetails;
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "Course", cascade = {
            CascadeType.PERSIST, CascadeType.MERGE,
            CascadeType.DETACH, CascadeType.REFRESH, CascadeType.REMOVE
    })
    @JsonIgnore
    List<Image> Image;
    //private List<Chapter> Chapters;
}
@Tag(name = "Course", description = "Course management APIs")
@RepositoryRestResource(path = "course")
public interface CourseRepository extends JpaRepository<Course, Integer> {
}

so when i test sort by using http://localhost:8888/course?sort=id,desc it's always return ascending

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 4, 2024
@phamquangvinhfpt
Copy link
Author

i have fix this

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@bclozel bclozel added status: invalid An issue that we don't feel is valid for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants