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

Jpa in plug-in not working #65

Open
guozhi72 opened this issue Jun 19, 2021 · 1 comment
Open

Jpa in plug-in not working #65

guozhi72 opened this issue Jun 19, 2021 · 1 comment

Comments

@guozhi72
Copy link

Hi:
I followed #27
I couldn’t make it work. Can somebody past entire code which include rest controller and jpa in plug-in.
I am surprised I could not find single example.

my controller to get list of entity which use jpa find all return null to postman. I put logging in the code. Before find all, message is logged. After fin fall, message didn’t show.

@guozhi72
Copy link
Author

In below plugin controler,
localhost:8080/student-controller/s1, some time I got message null, some time found Not found. But based on the loging,

2021-06-19 09:36:27.302 INFO 9740 --- [nio-8080-exec-5] com.houston.plugin.StudentPlugin : 1111
2021-06-19 09:36:27.306 INFO 9740 --- [nio-8080-exec-5] com.houston.plugin.StudentPlugin : 1111cccc exception={0}

exception happended, I followed #27, have not idea what is wrong( if I move my model and repository to main app, all works. )

@controller
@RequestMapping("/student-controller")
public class PluginController {

private static final Logger log = LoggerFactory.getLogger( StudentPlugin.class);

//
@Autowired
private StudentRepository studentRepository ;

@GetMapping
public ResponseEntity<String> greetStudent(){
    return ResponseEntity.ok().body("Hello from student plugin");
}

@GetMapping("/s1")
public List<Student> getAllStudents() {

    //pm.loadPlugins();

    //pm.startPlugins();
    log.info("1111");
    List<Student> students = null;
    try{
        students = studentRepository.findAll();
        log.info("1111aaaa");
        log.info(MessageFormat.format("*** number={0} students found ", String.valueOf(students.size())));
    }
    catch(PersistenceException e)
    {
        log.info("1111bbbb exception={0}", e.getMessage());
    }
    catch( Exception e){
        log.info("1111cccc exception={0}", e.getMessage());
    }



    return students;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant