Created
September 3, 2014 02:12
-
-
Save xenoterracide/7d568dad3dd3eb8912b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lm; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Import; | |
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | |
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; | |
@Configuration | |
@EnableJpaRepositories | |
@Import(RepositoryRestMvcConfiguration.class) | |
@EnableAutoConfiguration | |
public class Application { | |
public static void main(String[] args) { | |
SpringApplication.run(Application.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lm.model; | |
import org.hibernate.annotations.GenericGenerator; | |
import org.hibernate.validator.constraints.NotEmpty; | |
import javax.persistence.*; | |
import javax.validation.constraints.NotNull; | |
import javax.validation.constraints.Size; | |
import java.util.UUID; | |
@Entity | |
@Table(name = "tasks") | |
public class Task { | |
@Id | |
@NotNull | |
@GeneratedValue(generator="uuid2") | |
@GenericGenerator(name="uuid2", strategy = "uuid2") | |
@Column(name = "task_id", columnDefinition = "uuid") | |
private UUID id; | |
@NotNull | |
@NotEmpty | |
@Size(min = 1, max = 100) | |
private String description; | |
public String getDescription () { | |
return description; | |
} | |
public void setDescription (String description) { | |
this.description = description; | |
} | |
public UUID getId () { | |
return id; | |
} | |
public void setId (UUID id) { | |
this.id = id; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lm.repository; | |
import com.lm.model.Task; | |
import org.springframework.data.repository.PagingAndSortingRepository; | |
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | |
import java.util.UUID; | |
@RepositoryRestResource( collectionResourceRel = "task", path = "task") | |
public interface Tasks extends PagingAndSortingRepository<Task, UUID> { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment