Package javax.persistence

Examples of javax.persistence.TemporalType


   */
  private void getMapKeyTemporal(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key-temporal" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyTemporal.class );
      TemporalType value = TemporalType.valueOf( subelement.getTextTrim() );
      ad.setValue( "value", value );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here


        throw new AnnotationException(
            "@Temporal should only be set on a java.util.Date or java.util.Calendar property: "
                + StringHelper.qualify( persistentClassName, propertyName )
        );
      }
      final TemporalType temporalType = getTemporalType( property );
      switch ( temporalType ) {
        case DATE:
          type = isDate ? "date" : "calendar_date";
          break;
        case TIME:
View Full Code Here

   */
  private void getMapKeyTemporal(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key-temporal" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyTemporal.class );
      TemporalType value = TemporalType.valueOf( subelement.getTextTrim() );
      ad.setValue( "value", value );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

        throw new AnnotationException(
            "@Temporal should only be set on a java.util.Date or java.util.Calendar property: "
                + StringHelper.qualify( persistentClassName, propertyName )
        );
      }
      final TemporalType temporalType = getTemporalType( property );
      switch ( temporalType ) {
        case DATE:
          type = isDate ? "date" : "calendar_date";
          break;
        case TIME:
View Full Code Here

    if ( isTemporalType( mappedAttribute.getAttributeType() ) ) {
      if ( temporalAnnotation == null ) {
        //SPEC 11.1.47 The Temporal annotation must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.
        throw new AnnotationException( "Attribute " + mappedAttribute.getName() + " is a Temporal type, but no @Temporal annotation found." );
      }
      TemporalType temporalType = JandexHelper.getEnumValue( temporalAnnotation, "value", TemporalType.class );
      boolean isDate = Date.class.isAssignableFrom( mappedAttribute.getAttributeType() );
      String type;
      switch ( temporalType ) {
        case DATE:
          type = isDate ? StandardBasicTypes.DATE.getName() : StandardBasicTypes.CALENDAR_DATE.getName();
View Full Code Here

        throw new AnnotationException(
            "@Temporal should only be set on a java.util.Date or java.util.Calendar property: "
                + StringHelper.qualify( persistentClassName, propertyName )
        );
      }
      final TemporalType temporalType = getTemporalType( property );
      switch ( temporalType ) {
        case DATE:
          type = isDate ? "date" : "calendar_date";
          break;
        case TIME:
View Full Code Here

    /**
     * Parse temporal.
     */
    private void endMapKeyTemporal() {
        String temp = currentText();
        TemporalType _mapKeyTemporal = null;
        if (!StringUtils.isEmpty(temp))
            _mapKeyTemporal = Enum.valueOf(TemporalType.class, temp);
        FieldMapping fm = (FieldMapping) currentElement();
        List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns();
        if (cols.isEmpty()) {
View Full Code Here

        void onAttribute(
                JpaAttribute attribute,
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            TemporalType value = element.getAnnotation(Temporal.class).value();

            if (attribute instanceof JpaBasic) {
                ((JpaBasic) attribute).setTemporal(value);
            }
            // according to the spec, only @Basic is compatibel with @Temporal, however
View Full Code Here

            field.getMappingInfo().getTableName());
        if (strategy == PersistenceStrategy.BASIC && isLob(field)) {
            startElement("lob");
            endElement("lob");
        }
        TemporalType temporal = getTemporal(field);
        if (temporal != null) {
            startElement("temporal");
            addText(temporal.toString());
            endElement("temporal");
        }

        EnumType enumType = getEnumType(field);
        if (enumType != null && enumType != EnumType.ORDINAL) {
View Full Code Here

    /**
     * Parse temporal.
     */
    private void endMapKeyTemporal() {
        String temp = currentText();
        TemporalType _mapKeyTemporal = null;
        if (!StringUtils.isEmpty(temp))
            _mapKeyTemporal = Enum.valueOf(TemporalType.class, temp);
        FieldMapping fm = (FieldMapping) currentElement();
        List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns();
        if (cols.isEmpty()) {
View Full Code Here

TOP

Related Classes of javax.persistence.TemporalType

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.