mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
enhance mapping for ORM
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.alibaba.druid.bvt.mapping;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mapping.Entity;
|
||||
import com.alibaba.druid.mapping.MappingEngine;
|
||||
import com.alibaba.druid.mapping.Property;
|
||||
|
||||
|
||||
public class MySqlMappingTest extends TestCase {
|
||||
MappingEngine engine = new MappingEngine();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
Entity entity = new Entity();
|
||||
entity.setName("用户");
|
||||
entity.setTableName("user");
|
||||
|
||||
entity.addProperty(new Property("名称", "", "uid"));
|
||||
entity.addProperty(new Property("昵称", "", "name"));
|
||||
|
||||
engine.addEntity(entity);
|
||||
}
|
||||
|
||||
public void test_0 () throws Exception {
|
||||
String oql = "select * from 用户 u where u.名称 = 'a'";
|
||||
|
||||
String sql = engine.explainToSelectSQL(oql);
|
||||
|
||||
System.out.println(sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user