@Target(value=TYPE) @Retention(value=RUNTIME) public @interface JsonTable
[
{
"id":1,
"FirstName":"John",
"LastName":"Doe",
"Age":20
},
{
"id":2,
"FirstName":"Susan",
"LastName":"Webber",
"Age":55
},
{
"id":1,
"FirstName":"Mike",
"LastName":"Smith",
"Age":34
}
]
You can parse and read the contents of this file into an entity by defining
this annotation on a Entity class like
@Entity
@JsonTable(source=file, endpoint="/path/to/file.txt")
public class Person {
@Id
private int id;
@Column(name="FirstName")
private String firstName;
@Column(name="LastName")
private String lastName;
@Column(name="Age")
private int age;
...
}
Note: the getters and setter are omitted for brevity.Modifier and Type | Required Element and Description |
---|---|
String |
endpoint
On Class ONLY The endpoint where the document is located at.
|
Modifier and Type | Optional Element and Description |
---|---|
boolean |
ordinal
On Column ONLY, this defines the column as ordinal identity column.
|
String |
root
Root of the document where the parsing needs to start from.
|
boolean |
rootIsArray
JSON root content is array.
|
String |
source
Source name; If overriding the org.teiid.translator.ws.WsExecutionFactory
bean then provide the name of the bean
|
public abstract String endpoint
public abstract String source
public abstract boolean ordinal
public abstract String root
Copyright © 2019. All rights reserved.