Created
March 15, 2023 08:41
-
-
Save paulouskunda/7c91ce4a90cd7dec2b100a88d8fdd507 to your computer and use it in GitHub Desktop.
Recipe Entities
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
import com.fasterxml.jackson.annotation.JsonIgnore | |
import com.fasterxml.jackson.annotation.JsonProperty | |
import com.paul.data.Ingredients | |
import org.hibernate.annotations.CreationTimestamp | |
import java.util.* | |
import javax.persistence.* | |
@Entity | |
@Table(name ="ingredients") | |
data class IngredientsEntity ( | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
var ingredientsId: Int? = null, | |
@ManyToOne | |
@JoinColumn(name = "recipeId") | |
@JsonIgnore | |
var recipe: RecipeEntity? = null, | |
@CreationTimestamp | |
var createdAt: Date? = null, | |
var ingredientsDetail: String? = null | |
) |
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
import com.fasterxml.jackson.annotation.JsonIgnore | |
import org.hibernate.annotations.CreationTimestamp | |
import java.util.* | |
import javax.persistence.* | |
@Entity | |
@Table(name ="instructions") | |
data class InstructionsEntity ( | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
@JsonIgnore | |
var instructionsId: Int? = null, | |
@ManyToOne | |
@JoinColumn(name = "recipeId") | |
@JsonIgnore | |
var recipeKey: RecipeEntity? = null, | |
@CreationTimestamp | |
@JsonIgnore | |
var createdAt: Date? = null, | |
var instructionDetails: String? = null | |
) |
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
import com.fasterxml.jackson.annotation.JsonProperty | |
import org.hibernate.annotations.CreationTimestamp | |
import java.util.Date | |
import javax.persistence.* | |
import javax.xml.stream.events.ProcessingInstruction | |
@Entity | |
@Table(name ="recipe") | |
data class RecipeEntity ( | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
var recipeId: Int? = null, | |
var recipeName: String? = null, | |
var recipeInstructions: String? = null, | |
var recipeImage: String? = null, | |
@CreationTimestamp | |
var createdAt: Date? = null, | |
@OneToMany(mappedBy = "recipe") var ingredientsEntity: List<IngredientsEntity>? = null, | |
@OneToMany(mappedBy = "recipeKey") var instructionsEntity: List<InstructionsEntity>? = null | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment