本文整理汇总了Java中javax.persistence.TupleElement类的典型用法代码示例。如果您正苦于以下问题:Java TupleElement类的具体用法?Java TupleElement怎么用?Java TupleElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TupleElement类属于javax.persistence包,在下文中一共展示了TupleElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEntityFromTuple
import javax.persistence.TupleElement; //导入依赖的package包/类
private static <T> List<T> createEntityFromTuple(List<Tuple> tuples, Class<T> entity) {
List<T> entities = new ArrayList<>();
for (Tuple t : tuples) {
T el;
try {
el = entity.getConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException |
NoSuchMethodException | InvocationTargetException e) {
throw new AssertionError();
}
for (TupleElement<?> te : t.getElements()) {
Object o = t.get(te);
try {
Field f = getFieldFromEntity(entity, te.getAlias());
f.setAccessible(true);
f.set(el, o);
} catch (NoSuchFieldException | IllegalAccessException e1) {
throw new NoSuchEntityFieldException(e1.getMessage(), te.getAlias(), entity.getSimpleName());
}
}
entities.add(el);
}
return entities;
}
示例2: get
import javax.persistence.TupleElement; //导入依赖的package包/类
@Override
public <X> X get(TupleElement<X> element) {
throw new UnsupportedOperationException();
}
示例3: getElements
import javax.persistence.TupleElement; //导入依赖的package包/类
@Override
public List<TupleElement<?>> getElements() {
throw new UnsupportedOperationException();
}
示例4: get
import javax.persistence.TupleElement; //导入依赖的package包/类
@Override
public <X> X get(TupleElement<X> tupleElement) {
throw new UnsupportedOperationException("not implemented");
}
示例5: getElements
import javax.persistence.TupleElement; //导入依赖的package包/类
@Override
public List<TupleElement<?>> getElements() {
throw new UnsupportedOperationException("not implemented");
}
示例6: testGetByTupleNotSupported
import javax.persistence.TupleElement; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testGetByTupleNotSupported() {
impl.get((TupleElement<?>) null);
}
示例7: getElements
import javax.persistence.TupleElement; //导入依赖的package包/类
public List<TupleElement<?>> getElements() {
return tuple.getElements();
}
示例8: get
import javax.persistence.TupleElement; //导入依赖的package包/类
public <X> X get(TupleElement<X> tupleElement) {
return getSecureResult(tuple.get(tupleElement));
}
示例9: elemTypeName
import javax.persistence.TupleElement; //导入依赖的package包/类
static final String elemTypeName(TupleElement<?> e) {
return e.getJavaType().getName();
}