作者:工农大路店NOKIA客户服务中心 | 来源:互联网 | 2023-08-10 09:41
IamnewtoJDOandMySQL.Inmyproject,iwantthatallentitiesshouldbeconvertedintableauto
I am new to JDO and MySQL. In my project, i want that all entities should be converted in table automatically.
我是JDO和MySQL的新手。在我的项目中,我希望所有实体都应该自动转换为表格。
I had start using the JDO and defined properties like this,
我开始使用JDO并定义了这样的属性,
javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateCOnstraints=false
datanucleus.query.sql.allowAll = true
javax.jdo.option.COnnectionDriverName=com.mysql.jdbc.Driver
javax.jdo.option.COnnectionURL=jdbc:mysql://127.0.0.1:3306/db_name
javax.jdo.option.COnnectionUserName=user
javax.jdo.option.COnnectionPassword=123456
javax.jdo.option.Mapping=hsql
Sample entity:
@PersistenceCapable(identityType = IdentityType.APPLICATION, table = "heartbeat")
public class HeartBeat implements Serializable{
@PrimaryKey
@Column(length=128)
private String userId;
.......
}
Now, when i compile or run my application the tables are not being auto created. I am not sure which property i should use for auto creation of tables based on the entities created.
现在,当我编译或运行我的应用程序时,表格不是自动创建的。我不确定我应该使用哪个属性来根据创建的实体自动创建表。
Please bear with my question as i am new to JDO and MySQL integration.
请关注我的问题,因为我是JDO和MySQL集成的新手。
Thanks in advance.
提前致谢。
1 个解决方案