Created
May 18, 2018 02:07
-
-
Save ayinot/2fe5cb801f0aeb45f91642ebf82bea50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.example.schema | |
import net.corda.core.schemas.MappedSchema | |
import net.corda.core.schemas.PersistentState | |
import java.util.* | |
import javax.persistence.Column | |
import javax.persistence.Entity | |
import javax.persistence.Table | |
/** | |
* The family of schemas for LoanState. | |
*/ | |
object LoanSchema | |
/** | |
* An LoanState schema. | |
*/ | |
object LoanSchemaV1 : MappedSchema( | |
schemaFamily = LoanSchema.javaClass, | |
version = 1, | |
mappedTypes = listOf(PersistentLoan::class.java)) { | |
@Entity | |
@Table(name = "loan_states") | |
class PersistentLoan( | |
@Column(name = "lender") | |
var lenderName: String, | |
@Column(name = "borrower") | |
var borrowerName: String, | |
@Column(name = "loanAmount") | |
var loanAmount: Int, | |
@Column(name = "interestRate") | |
var interestRate: Int, | |
@Column(name = "loan_id") | |
var linearId: UUID | |
) : PersistentState() { | |
// Default constructor required by hibernate. | |
constructor(): this("", "",0, 0, UUID.randomUUID()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment