Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java companyid是Bean中的字段,那么它应该可以正常工作。[getKeyByCompanyid不可用请提供您的KeyEntity Bean。如果Company id是Bean中的字段,那么它应该可以正常工作。[为什么不使用继承的findById()方法_Java_Postgresql_Spring Boot_Web Services - Fatal编程技术网

Java companyid是Bean中的字段,那么它应该可以正常工作。[getKeyByCompanyid不可用请提供您的KeyEntity Bean。如果Company id是Bean中的字段,那么它应该可以正常工作。[为什么不使用继承的findById()方法

Java companyid是Bean中的字段,那么它应该可以正常工作。[getKeyByCompanyid不可用请提供您的KeyEntity Bean。如果Company id是Bean中的字段,那么它应该可以正常工作。[为什么不使用继承的findById()方法,java,postgresql,spring-boot,web-services,Java,Postgresql,Spring Boot,Web Services,companyid是Bean中的字段,那么它应该可以正常工作。[getKeyByCompanyid不可用请提供您的KeyEntity Bean。如果Company id是Bean中的字段,那么它应该可以正常工作。[为什么不使用继承的findById()方法?因为它不使用KeyEntity id,所以公司为什么不使用继承的findById()method?因为它不使用KeyEntity id,公司为什么不使用继承的findById()方法?我不知道如何@Ulfa Hartina在entity中写列


companyid是Bean中的字段,那么它应该可以正常工作。[getKeyByCompanyid不可用请提供您的KeyEntity Bean。如果Company id是Bean中的字段,那么它应该可以正常工作。[为什么不使用继承的
findById()
方法?因为它不使用KeyEntity id,所以公司为什么不使用继承的
findById()
method?因为它不使用KeyEntity id,公司为什么不使用继承的findById()方法?我不知道如何@Ulfa Hartina在entity中写列名,如果这个列属性名是id,他可以使用findById()方法。为什么不使用继承的findById()方法呢方法?我不知道如何@Ulfa Hartina在实体中写入列名,如果此列属性名为id,他可以使用findById()方法。如果我想使用return,我如何创建?我只想获得基于数据键的id,返回encKey?@GetMapping(path=“/getById/{company_id}”)字符串getById(@RequestBody KeyEntity KeyEntity,@PathVariable int company_id){String encKey=null;KeyEntity key=new KeyEntity();encKey=key.getKeyencrypted();gkrepo.findById(company_id);return encKey;}如果我想使用return,我该如何创建?我只想使用return encKey获取基于数据密钥的id?@GetMapping(路径=“/getById/{company_id}”)字符串getById(@RequestBody-KeyEntity-KeyEntity,@PathVariable-int-company_-id){String-encKey=null;KeyEntity-key=new-KeyEntity();encKey=key.getkeyecrypted();gkrepo.findById(company_-id);返回encKey;}”
    //Get Key

    @RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
    String getKey(@PathVariable int company_id) {
    String encKey = null;



    gkrepo.getKeyByCompanyid(company_id);

    return encKey;


}
public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer>
{

@Query(value= "SELECT * FROM tb_key", nativeQuery = true)
List<KeyEntity> getAll();

public void getKeyByCompanyid(Integer companyid);


}
 public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer>
 {

@Query(value= "SELECT * FROM tb_key", nativeQuery = true)
List<KeyEntity> getAll();

public KeyEntity findByCompanyId(Integer companyid);
 }
@RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
String getKey(@PathVariable int company_id) {
String encKey = null;

KeyEntity keyEntity = gkrepo.getKeyByCompanyid(company_id);

return keyEntity.getKey;

}
public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer>
 {

@Query(value= "SELECT * FROM tb_key", nativeQuery = true)
List<KeyEntity> getAll();

public KeyEntity findByCompanyId(Integer companyid);
 }
public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer>
  {

    @Query(value= "SELECT * FROM tb_key", nativeQuery = true)
    List<KeyEntity> getAll();

    public KeyEntity findByCompanyId(Integer companyid);
  }
public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer>
 {

    @Query(value= "SELECT * FROM tb_key", nativeQuery = true)
    List<KeyEntity> getAll();

    @Query(Select k from KeyEntity k where companyid = :companyid)    
    public KeyEntity getKeyByCompanyid(@Param("companyid") Integer companyid);
 }
@RestController
public class myController{

    @RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
    public KeyEntity getKey(@PathVariable("company_id") int companyId) {

        return gkrepo.findById(companyId); //inherited method
    }

}
@RestController
public class myController{

    @RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
    KeyEntity getKey(@PathVariable KeyEntity keyEntity) {

        return keyEntity; 
    }
}
@RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
    String getKey(@PathVariable int company_id) {
    String encKey = null;

    gkrepo.findOneByCompanyId(company_id);

    return encKey; //YOU RETURN NULL HERE
}
@RequestMapping(path="/getkey/{company_id}", method = RequestMethod.GET)
    String getKey(@PathVariable int company_id) {

    return gkrepo.getKeyByCompanyid(company_id).getKey();
}
public interface GenerateKeyRepository extends JpaRepository<KeyEntity, Integer> {

    @Query(value= "SELECT * FROM tb_key", nativeQuery = true)
    List<KeyEntity> getAll();

    public void findOneByCompanyId(Integer companyid);
}