org.hibernate.annotations.Fetch Java Examples
The following examples show how to use
org.hibernate.annotations.Fetch.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimingLocation.java From pikatimer with GNU General Public License v3.0 | 5 votes |
@OneToMany(mappedBy="timingLocation",fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) @Cascade(CascadeType.DELETE) public List<TimingLocationInput> getInputs() { //return associatedSplits.sorted((Split o1, Split o2) -> o1.getPosition().compareTo(o2.getPosition())); return timingInputList; }
Example #2
Source File: RaceAwards.java From pikatimer with GNU General Public License v3.0 | 5 votes |
@ElementCollection(fetch = FetchType.EAGER) @OneToMany(mappedBy="raceAward",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) @OrderColumn(name = "category_priority") public List<AwardCategory> getAwardCategories(){ return awardCategories; }
Example #3
Source File: Race.java From pikatimer with GNU General Public License v3.0 | 5 votes |
@OneToMany(mappedBy="race",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER) @OrderBy("split_seq_number") @Fetch(FetchMode.SELECT) public List<Split> getSplits() { return raceSplitList; //return raceSplits.sorted((Split o1, Split o2) -> o1.getPosition().compareTo(o2.getPosition())); }
Example #4
Source File: Violation.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
@Override @Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Breach.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "violation_id", referencedColumnName = "id", nullable = true) public List<IBreach> getBreaches() { return breaches; }
Example #5
Source File: GuaranteeTerm.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
@Override @Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Penalty.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "guarantee_term_id", referencedColumnName = "id", nullable = true) public List<IPenalty> getPenalties() { return penalties; }
Example #6
Source File: JobData.java From scheduling with GNU Affero General Public License v3.0 | 5 votes |
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "jobData") @Fetch(FetchMode.SELECT) @BatchSize(size = 10) @MapKey(name = "jobId") @PrimaryKeyJoinColumn(name = "JOB_ID") public List<JobContent> getJobContent() { return jobContent; }
Example #7
Source File: GuaranteeTerm.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
@Override @Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Violation.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "guarantee_term_id", referencedColumnName = "id", nullable = true) public List<IViolation> getViolations() { return violations; }
Example #8
Source File: GuaranteeTerm.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
@Override @Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Policy.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "guarantee_term_id", referencedColumnName = "id", nullable = true) public List<IPolicy> getPolicies() { return policies; }
Example #9
Source File: Agreement.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = GuaranteeTerm.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "agreement_id", referencedColumnName = "id", nullable = true) public List<IGuaranteeTerm> getGuaranteeTerms() { return guaranteeTerms; }
Example #10
Source File: AnnotationBinder.java From lams with GNU General Public License v2.0 | 4 votes |
protected static void defineFetchingStrategy(ToOne toOne, XProperty property) { LazyToOne lazy = property.getAnnotation( LazyToOne.class ); Fetch fetch = property.getAnnotation( Fetch.class ); ManyToOne manyToOne = property.getAnnotation( ManyToOne.class ); OneToOne oneToOne = property.getAnnotation( OneToOne.class ); FetchType fetchType; if ( manyToOne != null ) { fetchType = manyToOne.fetch(); } else if ( oneToOne != null ) { fetchType = oneToOne.fetch(); } else { throw new AssertionFailure( "Define fetch strategy on a property not annotated with @OneToMany nor @OneToOne" ); } if ( lazy != null ) { toOne.setLazy( !( lazy.value() == LazyToOneOption.FALSE ) ); toOne.setUnwrapProxy( ( lazy.value() == LazyToOneOption.NO_PROXY ) ); } else { toOne.setLazy( fetchType == FetchType.LAZY ); toOne.setUnwrapProxy( false ); } if ( fetch != null ) { if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) { toOne.setFetchMode( FetchMode.JOIN ); toOne.setLazy( false ); toOne.setUnwrapProxy( false ); } else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) { toOne.setFetchMode( FetchMode.SELECT ); } else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) { throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" ); } else { throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() ); } } else { toOne.setFetchMode( getFetchMode( fetchType ) ); } }
Example #11
Source File: Agreement.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = ServiceProperties.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "agreement_id", referencedColumnName = "id", nullable = true) public List<IServiceProperties> getServiceProperties() { return serviceProperties; }
Example #12
Source File: Provider.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Template.class, fetch = FetchType.EAGER) @JoinColumn(name = "provider_id", referencedColumnName = "id", nullable = true) public List<ITemplate> getTemplates() { return templates; }
Example #13
Source File: ServiceProperties.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @OneToMany(targetEntity = Variable.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "service_properties_id", referencedColumnName = "id", nullable = true) public List<IVariable> getVariableSet() { return variableSet; }
Example #14
Source File: RaceReport.java From pikatimer with GNU General Public License v3.0 | 4 votes |
@OneToMany(mappedBy="raceReport",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.LAZY) @Fetch(FetchMode.SELECT) public List<RaceOutputTarget> getRaceOutputTargets() { return raceOutputTargetList; }
Example #15
Source File: Race.java From pikatimer with GNU General Public License v3.0 | 4 votes |
@OneToMany(mappedBy="race",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) public List<RaceReport> getRaceReports() { return raceReportsList; }
Example #16
Source File: Race.java From pikatimer with GNU General Public License v3.0 | 4 votes |
@OneToMany(mappedBy="race",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) public List<Wave> getWaves() { return raceWavesList; }
Example #17
Source File: CollectionBinder.java From lams with GNU General Public License v2.0 | 4 votes |
private void defineFetchingStrategy() { LazyCollection lazy = property.getAnnotation( LazyCollection.class ); Fetch fetch = property.getAnnotation( Fetch.class ); OneToMany oneToMany = property.getAnnotation( OneToMany.class ); ManyToMany manyToMany = property.getAnnotation( ManyToMany.class ); ElementCollection elementCollection = property.getAnnotation( ElementCollection.class ); ManyToAny manyToAny = property.getAnnotation( ManyToAny.class ); FetchType fetchType; if ( oneToMany != null ) { fetchType = oneToMany.fetch(); } else if ( manyToMany != null ) { fetchType = manyToMany.fetch(); } else if ( elementCollection != null ) { fetchType = elementCollection.fetch(); } else if ( manyToAny != null ) { fetchType = FetchType.LAZY; } else { throw new AssertionFailure( "Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements" ); } if ( lazy != null ) { collection.setLazy( !( lazy.value() == LazyCollectionOption.FALSE ) ); collection.setExtraLazy( lazy.value() == LazyCollectionOption.EXTRA ); } else { collection.setLazy( fetchType == FetchType.LAZY ); collection.setExtraLazy( false ); } if ( fetch != null ) { if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) { collection.setFetchMode( FetchMode.JOIN ); collection.setLazy( false ); } else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) { collection.setFetchMode( FetchMode.SELECT ); } else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) { collection.setFetchMode( FetchMode.SELECT ); collection.setSubselectLoadable( true ); collection.getOwner().setSubselectLoadableCollections( true ); } else { throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() ); } } else { collection.setFetchMode( AnnotationBinder.getFetchMode( fetchType ) ); } }