Package javax.persistence

Examples of javax.persistence.PrimaryKeyJoinColumn


        void onEntity(
                JpaEntity entity,
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            PrimaryKeyJoinColumn annotation = element
                    .getAnnotation(PrimaryKeyJoinColumn.class);
            entity
                    .getPrimaryKeyJoinColumns()
                    .add(new JpaPrimaryKeyJoinColumn(annotation));
        }
View Full Code Here


            ? pkjc.referencedColumnName()
            : pkjc.name();
    }
   
    public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(Class<?> clazz) {
        PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
        if (pkjc != null) {
            return new PrimaryKeyJoinColumn[] { pkjc };
        }
       
        PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
View Full Code Here

        void onEntity(
                JpaEntity entity,
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            PrimaryKeyJoinColumn annotation = element
                    .getAnnotation(PrimaryKeyJoinColumn.class);
            entity
                    .getPrimaryKeyJoinColumns()
                    .add(new JpaPrimaryKeyJoinColumn(annotation));
        }
View Full Code Here

   */
  private void parseInheritanceJoin(Class c, SpeedoClass sc) {
    if (sc.inheritance == null) {
      return;
    }
    PrimaryKeyJoinColumn a1 = (PrimaryKeyJoinColumn) c.getAnnotation(PrimaryKeyJoinColumn.class);
    PrimaryKeyJoinColumns a2 = (PrimaryKeyJoinColumns) c.getAnnotation(PrimaryKeyJoinColumns.class);
    if ((a1 == null) && (a2 == null)) {
      return;
    }
    if ((a1 != null) && (a2 != null)) {
      nbErrors++;
      logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
          + ": can only support a unique join description - two found (a join column and a set of join columns)!");
      return;
    }
    if (a2.value().length == 1) {
      a1 = a2.value()[0];
    }
    sc.inheritance.join = new SpeedoJoin();
    sc.inheritance.join.mainTable = sc.mainTable;
    sc.inheritance.join.extTable = sc.getSuper().mainTable;
    // First parse PrimaryKeyJoinColumn
    if (a1 != null) {
      SpeedoJoinColumn jcol = new SpeedoJoinColumn();
      jcol.column = sc.getColumn(a1.name(), true);
      if (jcol.column == null) {
        nbErrors++;
        logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
            + ": inheritance join define with a column that does not exist - ("
            + a1.name() + ") not found!");
        return;
      }
      if (a1.referencedColumnName().equals("")) {
        nbErrors++;
        logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
            + ": inheritance join define with no column associated in superclass!");
        return;
      }
      jcol.targetColumn = a1.referencedColumnName();
      sc.inheritance.join.columns.add(jcol);
      return;
    }
    // Now parse PrimaryKeyJoinColumns: the PrimaryKeyJoinColmun from the "pkjcs" array
    for (PrimaryKeyJoinColumn pkjc : a2.value()) {
View Full Code Here

        void onEntity(
                JpaEntity entity,
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            PrimaryKeyJoinColumn annotation = element
                    .getAnnotation(PrimaryKeyJoinColumn.class);
            entity
                    .getPrimaryKeyJoinColumns()
                    .add(new JpaPrimaryKeyJoinColumn(annotation));
        }
View Full Code Here

        void onEntity(
                JpaEntity entity,
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            PrimaryKeyJoinColumn annotation = element
                    .getAnnotation(PrimaryKeyJoinColumn.class);
            entity
                    .getPrimaryKeyJoinColumns()
                    .add(new JpaPrimaryKeyJoinColumn(annotation));
        }
View Full Code Here

      //@Inheritance(JOINED) subclass need to link back to the super entity
      PrimaryKeyJoinColumns jcsAnn = clazzToProcess.getAnnotation( PrimaryKeyJoinColumns.class );
      boolean explicitInheritanceJoinedColumns = jcsAnn != null && jcsAnn.value().length != 0;
      if ( explicitInheritanceJoinedColumns ) {
        int nbrOfInhJoinedColumns = jcsAnn.value().length;
        PrimaryKeyJoinColumn jcAnn;
        inheritanceJoinedColumns = new Ejb3JoinColumn[nbrOfInhJoinedColumns];
        for ( int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++ ) {
          jcAnn = jcsAnn.value()[colIndex];
          inheritanceJoinedColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
              jcAnn, null, superEntity.getIdentifier(),
              ( Map<String, Join> ) null, ( PropertyHolder ) null, mappings
          );
        }
      }
      else {
        PrimaryKeyJoinColumn jcAnn = clazzToProcess.getAnnotation( PrimaryKeyJoinColumn.class );
        inheritanceJoinedColumns = new Ejb3JoinColumn[1];
        inheritanceJoinedColumns[0] = Ejb3JoinColumn.buildJoinColumn(
            jcAnn, null, superEntity.getIdentifier(),
            ( Map<String, Join> ) null, ( PropertyHolder ) null, mappings
        );
View Full Code Here

   */
  private PrimaryKeyJoinColumns getPrimaryKeyJoinColumns(Element element, XMLContext.Default defaults, boolean mergeWithAnnotations) {
    PrimaryKeyJoinColumn[] columns = buildPrimaryKeyJoinColumns( element );
    if ( mergeWithAnnotations ) {
      if ( columns.length == 0 && defaults.canUseJavaAnnotations() ) {
        PrimaryKeyJoinColumn annotation = getJavaAnnotation( PrimaryKeyJoinColumn.class );
        if ( annotation != null ) {
          columns = new PrimaryKeyJoinColumn[] { annotation };
        }
        else {
          PrimaryKeyJoinColumns annotations = getJavaAnnotation( PrimaryKeyJoinColumns.class );
View Full Code Here

      //@Inheritance(JOINED) subclass need to link back to the super entity
      PrimaryKeyJoinColumns jcsAnn = annotatedClass.getAnnotation( PrimaryKeyJoinColumns.class );
      boolean explicitInheritanceJoinedColumns = jcsAnn != null && jcsAnn.value().length != 0;
      if ( explicitInheritanceJoinedColumns ) {
        int nbrOfInhJoinedColumns = jcsAnn.value().length;
        PrimaryKeyJoinColumn jcAnn;
        inheritanceJoinedColumns = new Ejb3JoinColumn[nbrOfInhJoinedColumns];
        for (int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++) {
          jcAnn = jcsAnn.value()[colIndex];
          inheritanceJoinedColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
              jcAnn, null, superEntity.getIdentifier(),
              (Map<String, Join>) null, (PropertyHolder) null, mappings
          );
        }
      }
      else {
        PrimaryKeyJoinColumn jcAnn = annotatedClass.getAnnotation( PrimaryKeyJoinColumn.class );
        inheritanceJoinedColumns = new Ejb3JoinColumn[1];
        inheritanceJoinedColumns[0] = Ejb3JoinColumn.buildJoinColumn(
            jcAnn, null, superEntity.getIdentifier(),
            (Map<String, Join>) null, (PropertyHolder) null, mappings
        );
View Full Code Here

      //@Inheritance(JOINED) subclass need to link back to the super entity
      PrimaryKeyJoinColumns jcsAnn = annotatedClass.getAnnotation( PrimaryKeyJoinColumns.class );
      boolean explicitInheritanceJoinedColumns = jcsAnn != null && jcsAnn.value().length != 0;
      if ( explicitInheritanceJoinedColumns ) {
        int nbrOfInhJoinedColumns = jcsAnn.value().length;
        PrimaryKeyJoinColumn jcAnn;
        inheritanceJoinedColumns = new Ejb3JoinColumn[nbrOfInhJoinedColumns];
        for (int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++) {
          jcAnn = jcsAnn.value()[colIndex];
          inheritanceJoinedColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
              jcAnn, null, superEntity.getIdentifier(),
              (Map<String, Join>) null, (PropertyHolder) null, mappings
          );
        }
      }
      else {
        PrimaryKeyJoinColumn jcAnn = annotatedClass.getAnnotation( PrimaryKeyJoinColumn.class );
        inheritanceJoinedColumns = new Ejb3JoinColumn[1];
        inheritanceJoinedColumns[0] = Ejb3JoinColumn.buildJoinColumn(
            jcAnn, null, superEntity.getIdentifier(),
            (Map<String, Join>) null, (PropertyHolder) null, mappings
        );
View Full Code Here

TOP

Related Classes of javax.persistence.PrimaryKeyJoinColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.