大家好,我收到下一个错误,我是使用Hibernate的新手
package ar.com.lakaut.sig.core.service;
import ar.com.lakaut.sig.core.domain.SoftwareVersion;
import com.curcico.jproject.core.services.BaseAuditedEntityService;
import com.curcico.jproject.core.exception.BaseException;
public interface SoftwareVersionService extends BaseAuditedEntityService<SoftwareVersion>{
public SoftwareVersion getSoftwareVersion(String name) throws BaseException;
public SoftwareVersion getSoftwareVersion(Integer id) throws BaseException;
public void addSoftwareVersion(SoftwareVersion softwareVersion) throws BaseException;
public void updateSoftwareVersion(SoftwareVersion oldSoftwareVersion, SoftwareVersion newSoftwareVersion) throws BaseException;
public void deleteSoftwareVersion(SoftwareVersion softwareVersion) throws BaseException;
}
package ar.com.lakaut.sig.core.dao;
import com.curcico.jproject.core.daos.BaseAuditedEntityDao;
import com.curcico.jproject.core.exception.BaseException;
import com.curcico.jproject.core.exception.InternalErrorException;
import ar.com.lakaut.sig.core.domain.SoftwareVersion;
public interface SoftwareVersionDao extends BaseAuditedEntityDao<SoftwareVersion>{
SoftwareVersion getSoftwareVersion(Integer id, boolean users) throws InternalErrorException;
SoftwareVersion getSoftwareVersion(Integer id) throws InternalErrorException;
SoftwareVersion getSoftwareVersion(String sft_product_name) throws InternalErrorException;
String getNextSoftwareVersionBarcodePrefix() throws BaseException;
}
package ar.com.lakaut.sig.core.dao;
import ar.com.lakaut.sig.core.domain.SoftwareVersion;
import com.curcico.jproject.core.daos.ConditionEntry;
import com.curcico.jproject.core.daos.ManagerAlias;
import com.curcico.jproject.core.daos.ManagerFetchs;
import com.curcico.jproject.core.exception.BaseException;
import com.curcico.jproject.core.exception.InternalErrorException;
import com.curcico.jproject.core.wrapper.GridWrapper;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.curcico.jproject.core.daos.BaseAuditedEntityDaoImpl;
public class SoftwareVersionDaoImpl extends BaseAuditedEntityDaoImpl<SoftwareVersion> implements SoftwareVersionDao {
public SoftwareVersionDaoImpl() { }
@Override
public SoftwareVersion getSoftwareVersion(Integer id, boolean users) throws InternalErrorException {
return null;
}
@Override
public SoftwareVersion getSoftwareVersion(Integer id) throws InternalErrorException {
return null;
}
public SoftwareVersion getSoftwareVersion(String sft_product_name) throws InternalErrorException {
logger.debug("getLastKia-DesktopSoftwareVersion");
String sql = "select" + "* from sig_versions where sft_product_name like 'kiadoc-desktop' order by created_date DESC limit 1";
Query query = this.sessionFactory.getCurrentSession().createSQLQuery(sql);
List result = query.list();
SoftwareVersion softwareVersion = new SoftwareVersion();
softwareVersion.set_Version(result.get(0).toString());
return null;
}
@Override
public String getNextSoftwareVersionBarcodePrefix() throws BaseException {
return null;
}
@Override
public SoftwareVersion update(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion save(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion saveOrUpdate(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion delete(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion loadEntityById(Integer id) throws BaseException {
return null;
}
@Override
public SoftwareVersion loadEntityById(Integer id, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public SoftwareVersion loadEntityByFilters(List<ConditionEntry> filters) throws BaseException {
return null;
}
@Override
public SoftwareVersion loadEntityByFilters(List<ConditionEntry> filters, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public Long count() throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findAll() throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findAll(Integer numeroDePagina, Integer tamanioPagina) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findAll(String orderBy, String orderMode) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findAll(Integer numeroDePagina, Integer tamanioPagina, String orderBy, String orderMode) throws BaseException {
return null;
}
@Override
public List<Integer> getIds() throws BaseException {
return null;
}
@Override
public Long countByFilters(List<ConditionEntry> conditions) throws BaseException {
return null;
}
@Override
public Long countByFilters(Criteria criteria, List<ConditionEntry> filters) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findByFilters(List<ConditionEntry> conditions) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findByFilters(List<ConditionEntry> filters, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findByFilters(List<ConditionEntry> conditions, Integer numeroDePagina, Integer tamanioPagina, String orderBy, String orderMode, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public Collection<? extends SoftwareVersion> findByFilters(Criteria criteria, List<ConditionEntry> filters, Integer page, Integer rows, String orderBy, String orderMode, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public GridWrapper<? extends SoftwareVersion> findByFiltersGridWrapper(List<ConditionEntry> filters, Integer page, Integer rows, String orderBy, String orderMode, Set<ManagerFetchs> fetchs) throws BaseException {
return null;
}
@Override
public Set<ManagerAlias> getAlias() {
return null;
}
@Override
public Set<ManagerFetchs> getFetchs() {
return null;
}
@Override
public SessionFactory getSessionFactory() {
return null;
}
@Override
public List<List<String>> getContentReportGeneric(String sql, Map<String, Object> param, List<String> fieldSelect) {
return null;
}
@Override
public Criteria getCriteria() throws BaseException {
return null;
}
@Override
public Criteria getCriteria(String alias) throws BaseException {
return null;
}
}
package ar.com.lakaut.sig.core.service;
import ar.com.lakaut.sig.core.domain.SoftwareVersion;
import com.curcico.jproject.core.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.curcico.jproject.core.services.BaseAuditedEntityServiceImpl;
import ar.com.lakaut.sig.core.dao.SoftwareVersionDao;
import org.apache.log4j.Logger;
@Service("softwareVersionService")
public class SoftwareVersionServiceImpl extends BaseAuditedEntityServiceImpl<SoftwareVersion, SoftwareVersionDao> implements SoftwareVersionService {
Logger logger = Logger.getLogger(SoftwareVersionServiceImpl.class);
@Autowired
private SoftwareVersionDao softwareVersionDao;
@Override
public SoftwareVersion getSoftwareVersion(Integer id) throws BaseException {
logger.info("softwareVersionId: " + id);
return softwareVersionDao.getSoftwareVersion(id);
}
@Override
public SoftwareVersion getSoftwareVersion(String sft_product_name) throws BaseException {
logger.info("softwareVersionId: " + sft_product_name);
return softwareVersionDao.getSoftwareVersion(sft_product_name);
}
@Override
public void addSoftwareVersion(SoftwareVersion softwareVersion) throws BaseException {
}
@Override
public void updateSoftwareVersion(SoftwareVersion oldSoftwareVersion, SoftwareVersion newSoftwareVersion) throws BaseException {
}
@Override
public void deleteSoftwareVersion(SoftwareVersion softwareVersion) throws BaseException {
}
@Override
public SoftwareVersion update(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion save(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion saveOrUpdate(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
@Override
public SoftwareVersion delete(SoftwareVersion object, Integer user) throws BaseException {
return null;
}
}
package ar.com.lakaut.sig.core.domain;
import com.curcico.jproject.core.entities.BaseAuditedEntity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "sig_versions")
@SQLDelete(sql="UPDATE sig_versions SET deleted = '1' WHERE version_id = ? and version = ?")
@Where(clause="deleted is null")
public class SoftwareVersion extends BaseAuditedEntity implements Serializable {
public SoftwareVersion() {}
private String product_name;
private String sft_version;
private String obs;
public SoftwareVersion(String product_name, String version, String obs, Integer created_user, Integer updated_user) {
super();
this.id = id;
this.product_name = product_name;
this.sft_version = version;
this.obs = obs;
}
public SoftwareVersion(Integer id){
super();
setId(id);
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
@Id
@SequenceGenerator(name = "id_generator", sequenceName = "sig_versions_config_seq", allocationSize = 1)
@GeneratedValue(generator = "id_generator", strategy =GenerationType.SEQUENCE)
@Column(name = "sft_id", unique = true, nullable = false)
public Integer getId() { return this.id; }
@Column(name = "sft_product_name", nullable = false)
public String getProductName() { return product_name; }
public void setProductName(String product_name) { this.product_name = product_name; }
@Column(name = "sft_version", nullable = false)
public String get_Version() { return sft_version; }
public void set_Version(String version) { this.sft_version = version; }
@Column(name = "sft_obs", nullable = false)
public String getObs() { return obs; }
public void setObs(String obs) { this.obs = obs; }
}
谢谢你们的帮助。我已经这样解决了。
@Repository
public class SoftwareVersionDaoImpl extends BaseAuditedEntityDaoImpl<SoftwareVersion> implements SoftwareVersionDao {
public class SoftwareVersionDaoImpl extends BaseAuditedEntityDaoImpl<SoftwareVersion> implements SoftwareVersionDao {
public SoftwareVersionDaoImpl() { }
public SoftwareVersionDaoImpl() { super(); }
我已经添加了@Repository注释和super();构造器
问题内容: 我正在开发一个小型Java EE Hibernate Spring应用程序,出现错误: 这是我的控制器ArticleControleur,其中包含用于恢复文章列表的功能: 这是我的articleService: 这是我的应用程序上下文: 问题答案: 该错误表明不是注册的Bean。添加其中包含将在你的应用程序上下文中自动装配的bean的软件包: 或者,如果你想将所有子包包括在com.bd
这是我的当前设置:ProjectRepo: ProjectService: ProjectRestController:
问题内容: 我测试了我的DAO,但是没有用。发生以下错误: 我的DAO: 我对此DAO的测试: 我的 applicationContext.xml : 我注意到,如果您在DAO中评论@Transactional,则将正确创建bean。怎么了? 问题答案: 首先,将以Controller结尾的名称给DAO确实很令人困惑,Controller和DAO共同具有不同的目的。 当您添加到服务或dao类时,为
pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd“xmlns=”http://maven.apache.org/POM/4.0.0“xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance" 堆栈跟踪: (临时Github链接到完整的项目)https://github.com/kolos181/S
我做了一些搜索,但我无法找出是什么问题。我知道这个问题来自于ClassNotFoundException,但我无法解决它。 我把我需要的东西都装上了(嗯,我想)。下面是我的代码: DAO类: 服务类别: