private static String determineNameOfPropertyToUse(PostInsertIdentityPersister persister, String supplied) { if ( supplied != null ) { return supplied; } int[] naturalIdPropertyIndices = persister.getNaturalIdentifierProperties(); if ( naturalIdPropertyIndices == null ) { throw new IdentifierGenerationException( "no natural-id property defined; need to specify [key] in " + "generator parameters" ); } if ( naturalIdPropertyIndices.length > 1 ) { throw new IdentifierGenerationException( "select generator does not currently support composite " + "natural-id properties; need to specify [key] in generator parameters" ); } if ( persister.getEntityMetamodel().isNaturalIdentifierInsertGenerated() ) { throw new IdentifierGenerationException( "natural-id also defined as insert-generated; need to specify [key] " + "in generator parameters" ); } return persister.getPropertyNames()[naturalIdPropertyIndices[0]]; }
private static String determineNameOfPropertyToUse(PostInsertIdentityPersister persister, String supplied) { if ( supplied != null ) { return supplied; } int[] naturalIdPropertyIndices = persister.getNaturalIdentifierProperties(); if ( naturalIdPropertyIndices == null ){ throw new IdentifierGenerationException( "no natural-id property defined; need to specify [key] in " + "generator parameters" ); } if ( naturalIdPropertyIndices.length > 1 ) { throw new IdentifierGenerationException( "select generator does not currently support composite " + "natural-id properties; need to specify [key] in generator parameters" ); } ValueInclusion inclusion = persister.getPropertyInsertGenerationInclusions() [ naturalIdPropertyIndices[0] ]; if ( inclusion != ValueInclusion.NONE ) { throw new IdentifierGenerationException( "natural-id also defined as insert-generated; need to specify [key] " + "in generator parameters" ); } return persister.getPropertyNames() [ naturalIdPropertyIndices[0] ]; }
private static String determineNameOfPropertyToUse(PostInsertIdentityPersister persister, String supplied) { if ( supplied != null ) { return supplied; } int[] naturalIdPropertyIndices = persister.getNaturalIdentifierProperties(); if ( naturalIdPropertyIndices == null ){ throw new IdentifierGenerationException( "no natural-id property defined; need to specify [key] in " + "generator parameters" ); } if ( naturalIdPropertyIndices.length > 1 ) { throw new IdentifierGenerationException( "select generator does not currently support composite " + "natural-id properties; need to specify [key] in generator parameters" ); } if ( persister.getPropertyInsertGeneration() [ naturalIdPropertyIndices[0] ] ) { throw new IdentifierGenerationException( "natural-id also defined as insert-generated; need to specify [key] " + "in generator parameters" ); } return persister.getPropertyNames() [ naturalIdPropertyIndices[0] ]; }
private static String determineNameOfPropertyToUse(PostInsertIdentityPersister persister, String supplied) { if ( supplied != null ) { return supplied; } int[] naturalIdPropertyIndices = persister.getNaturalIdentifierProperties(); if ( naturalIdPropertyIndices == null ){ throw new IdentifierGenerationException( "no natural-id property defined; need to specify [key] in " + "generator parameters" ); } if ( naturalIdPropertyIndices.length > 1 ) { throw new IdentifierGenerationException( "select generator does not currently support composite " + "natural-id properties; need to specify [key] in generator parameters" ); } ValueInclusion inclusion = persister.getPropertyInsertGenerationInclusions() [ naturalIdPropertyIndices[0] ]; if ( inclusion != ValueInclusion.NONE ) { throw new IdentifierGenerationException( "natural-id also defined as insert-generated; need to specify [key] " + "in generator parameters" ); } return persister.getPropertyNames() [ naturalIdPropertyIndices[0] ]; }