Announcement Announcement Module
Collapse
No announcement yet.
spring-data-jpa - overriding existing repository methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-data-jpa - overriding existing repository methods

    The documentation describes nicely what has to be done if I want to implement my custom repository method.

    Still I am in a need of overriding existing repository methods. Without using spring-data-jpa I could do:

    Code:
    	public AdContent load( Long id ) {
    		AdContent adContent = super.load( id );
    		adContent.setContentUrl( getPath() + adContent.getAd().getId().toString() );
    		return adContent;
    	}
    or
    Code:
    	public void delete( AdContent adContent ) {
    		super.delete( adContent );
    
    		File file = new File( adContent.getContentUrl() );
    		if ( file.exists() && !file.delete() ) {
    			throw new RuntimeException( "error deleting file [" + adContent.getContentUrl() + "]" );
    		}
    	}
    Can I achieve the same functionality without much hassle?
Working...
X