1
//$Id: ElementPropertyMapping.java 6179 2005-03-23 15:41:48Z steveebersole $
2
package org.hibernate.persister.collection;
4
import org.hibernate.MappingException;
6
import org.hibernate.QueryException;
8
import org.hibernate.persister.entity.PropertyMapping;
10
import org.hibernate.type.Type;
12
import org.hibernate.util.StringHelper;
17
public class ElementPropertyMapping implements PropertyMapping {
19
private final String[] elementColumns;
20
private final Type type;
22
public ElementPropertyMapping(String[] elementColumns, Type type)
23
throws MappingException {
24
this.elementColumns = elementColumns;
28
public Type toType(String propertyName) throws QueryException {
29
if ( propertyName==null || "id".equals(propertyName) ) {
33
throw new QueryException("cannot dereference scalar collection element: " + propertyName);
37
public String[] toColumns(String alias, String propertyName) throws QueryException {
38
if (propertyName==null || "id".equals(propertyName) ) {
39
return StringHelper.qualify(alias, elementColumns);
42
throw new QueryException("cannot dereference scalar collection element: " + propertyName);
47
* Given a property path, return the corresponding column name(s).
49
public String[] toColumns(String propertyName) throws QueryException, UnsupportedOperationException {
50
throw new UnsupportedOperationException( "References to collections must be define a SQL alias" );
53
public Type getType() {
b'\\ No newline at end of file'