mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-24 17:17:49 +01:00
Database stuffffff
This commit is contained in:
parent
aed6eff863
commit
efc8a32f98
@ -1,5 +1,6 @@
|
||||
package com.Acrobot.Breeze.Database;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
@ -31,6 +32,27 @@ public class Database {
|
||||
return new Table(this, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a table from a given class
|
||||
*
|
||||
* @param clazz Class with fields
|
||||
* @return If table was succesfully created
|
||||
*/
|
||||
public boolean createFromClass(Class clazz) {
|
||||
if (!clazz.isAnnotationPresent(Entity.class) || !clazz.isAnnotationPresent(javax.persistence.Table.class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String tableName = ((javax.persistence.Table) clazz.getAnnotation(javax.persistence.Table.class)).name();
|
||||
Table table = getTable(tableName);
|
||||
|
||||
EntityParser parser = new EntityParser(clazz);
|
||||
|
||||
//TODO Finish this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Connection to the database
|
||||
* @throws SQLException exception
|
||||
|
@ -46,6 +46,6 @@ public class EntityParser {
|
||||
* @return SQL type
|
||||
*/
|
||||
public String convertToSQL(Field field) {
|
||||
return null;
|
||||
return null; //TODO Finish this
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user