JPA guide for CAS

29 views
Skip to first unread message

Pablo Vidaurri

unread,
May 20, 2021, 7:34:18 PM5/20/21
to CAS Community
Does anyone have a guide or github example of setting up JPA in CAS 6.3.x?

I'm trying to get the spring-boot way to work but I keep getting various errors with missing beans, undefined jpa data models etc. All works with standalone spring-boot2 app but not working out with cas template project.

build.gradle:
 implementation ("org.springframework.boot:spring-boot-starter-data-jpa:2.3.9.RELEASE") {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
       exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
    }

@Data
@RequiredArgsConstructor
@NoArgsConstructor(access=AccessLevel.PRIVATE, force=true)
@Entity
public class  MyUser implements Serializable { 
@Id
private final String userId;
...
}


@Repository
public interface MyUserRepository extends JpaRepository< MyUser  , String> {...}

@Service
@Transactional(readOnly = true)
public class MyUserService { 
@Autowired
private  MyUserRepository    myUserRepository   ;

@Transactional(readOnly = true)
public  MyUser   findByUserId(String id) {
return  myUserRepository.findByUserId(id);
}
}


Thanks in advance
-psv

Reply all
Reply to author
Forward
0 new messages