Код: Выделить всё
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flotaService': Unsatisfied dependency expressed through field 'repository': Error creating bean with name 'flotaRepository' defined in zerog.flota.FlotaRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Expected id attribute type [class java.lang.Long] in the existing id attributes [[SingularAttributeImpl[BasicTypeImpl@1605430451:long [ javaType: long],org.eclipse.persistence.mappings.DirectToFieldMapping[id-->flotas.id]]]] on the identifiable type [EntityTypeImpl@1516081143:Flota [ javaType: class zerog.flota.Flota descriptor: RelationalDescriptor(zerog.flota.Flota --> [DatabaseTable(flotas)]), mappings: 58]] but found attribute types [[long]].
Код: Выделить всё
public class Flota{
@Id
@TableGenerator(name="TABLE_GEN_FLOTA", table="sequence", pkColumnName="SEQ_NAME", valueColumnName="SEQ_COUNT", pkColumnValue="flotas")
@GeneratedValue(strategy=GenerationType.TABLE, generator="TABLE_GEN_FLOTA")
@Column(name = "id")
protected long id;
// code...
}
@Repository
public interface FlotaRepository extends JpaRepository
{
@Service
public class FlotaService {
@Autowired
private FlotaRepository repository;
public List findAll() {
return repository.findAll();
}
public Optional findById(long id) {
return repository.findById(id);
}
}
Спасибо заранее
Подробнее здесь: https://stackoverflow.com/questions/785 ... clipselink
Мобильная версия