jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duncanm <duncan.mcint...@gr-tech.net>
Subject OCM Collection Mapping
Date Thu, 27 Mar 2008 18:37:57 GMT

Is there any documentation which explains how to map child nodes using OCM?

I have tried the following and it does not work. When I load a Folder, the
children property is null - no proxy is set so I cannot get to its children.

I have had to create my own grt:Container and grt:Node types so that the SNS
constraint is properly respected - but that is another story.

Can anyone tell me what is wrong?

@Node(jcrType="grt:Container", jcrMixinTypes = "mix:referenceable", extend =
Content.class)
public class Folder extends Content {
	
	@Collection(
				proxy = true, 
				autoUpdate = false, 
				autoInsert = false, 
				autoRetrieve = true, 
				elementClassName = Content.class, 
				jcrSameNameSiblings = false
	)
	protected List children;

	public List getChildren() {
		return children;
	}

	public void setChildren(List children) {
		this.children = children;
	}

}

with

@Node(jcrType="grt:Node", isAbstract=true)
public abstract class Content {
	
	@Field(path=true) String path;
	@Field(jcrName="grt:name") String title; 
	@Field(jcrName="grt:startDate") Date startDate;
	@Field(jcrName="grt:endDate") Date endDate;
	@Field(jcrName="grt:creator") Integer creator;
	@Field(jcrName="grt:modifier") Integer modifier;
	@Field(jcrName="grt:status") Integer status = 0;
	@Field(uuid=true) private String uuid; 
	
    @Bean(converter=ParentBeanConverterImpl.class)
    protected Folder parentFolder;
    
	public Folder getParentFolder() {
		return parentFolder;
	}
	public void setParentFolder(Folder parentFolder) {
		this.parentFolder = parentFolder;
	}
	public String getUuid() {
		return uuid;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

...
... etc
}
-- 
View this message in context: http://www.nabble.com/OCM-Collection-Mapping-tp16330951p16330951.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message