Project

General

Profile

Download (1.07 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2013 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.persistence.dao.initializer;
10

    
11
import eu.etaxonomy.cdm.model.media.Media;
12
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
13

    
14

    
15
/**
16
 * @author a.kohlbecker
17
 * @date Jan 15, 2013
18
 *
19
 */
20
public class MediaAutoInitializer extends AutoPropertyInitializer<Media> {
21

    
22
    @Override
23
    public void initialize(Media bean) {
24
        beanInitializer.initializeInstance(bean.getAllTitles());
25
        for (MediaRepresentation r : bean.getRepresentations()){
26
            beanInitializer.initializeInstance(r.getParts());
27
        }
28
    }
29
    
30
    
31
    @Override
32
    public String hibernateFetchJoin(Class<?> clazz, String beanAlias) throws Exception{
33
    	return String.format(" LEFT JOIN FETCH %s.representations r LEFT JOIN FETCH r.mediaRepresentationParts ", beanAlias); 
34
    }
35
}
(9-9/13)