Apache NetBeans version
Apache NetBeans 30
What happened
I keep getting a warning "No constructors can de found that match the argument types" for HQL with DTO class.
Language / Project Type / NetBeans Component
Java Maven Web application project
How to reproduce
Package structure (simplified):
- webapp (REST controllers)
- api (interface, dto)
- core (DAO, service)
- api (interface, dto)
- ent (entities)
in example-api:
package com.example.domain;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ResourceCategoryMini {
private Long id;
private Boolean active;
private String label;
private String description;
}
in example-core:
package com.example.core.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.example.domain.ResourceCategoryMini;
@Repository
public class ResourceCategoryDAO {
@Autowired
protected SessionFactory sessionFactory;
/**
* Returns a minimal resource category list.
*
* @return resource category list
*/
public List<ResourceCategoryMini> listMini() {
Session session = sessionFactory.getCurrentSession();
var results = session.createQuery("""
select new com.example.domain.ResourceCategoryMini(
r.id,
r.active,
r.label,
r.description
)
from ResourceCategoryEntity r
order by id asc
""", ResourceCategoryMini.class)
.getResultList();
return results;
}
}
Did this work correctly in an earlier version?
No
Operating System
Windows 11 version 10.0 running on amd64; UTF-8; pl_PL (nb)
JDK
Runtime: OpenJDK Runtime Environment 21.0.8+9-LTS
Apache NetBeans packaging
Community provided installer
Anything else
That error is always shown when using DTO class in HQL.
Oh, and the project is based on Spring MVC + Hibernate + HikariCP data-source if that matters.
Are you willing to submit a pull request?
No
Apache NetBeans version
Apache NetBeans 30
What happened
I keep getting a warning "No constructors can de found that match the argument types" for HQL with DTO class.
Language / Project Type / NetBeans Component
Java Maven Web application project
How to reproduce
Package structure (simplified):
in example-api:
in example-core:
Did this work correctly in an earlier version?
No
Operating System
Windows 11 version 10.0 running on amd64; UTF-8; pl_PL (nb)
JDK
Runtime: OpenJDK Runtime Environment 21.0.8+9-LTS
Apache NetBeans packaging
Community provided installer
Anything else
That error is always shown when using DTO class in HQL.
Oh, and the project is based on Spring MVC + Hibernate + HikariCP data-source if that matters.
Are you willing to submit a pull request?
No
Make sure you're using a Lombok version compatible with JDK 26, and review the information in #8221