[hibernate-commits] Hibernate SVN: r18756 - in jpamodelgen/trunk/src: test/java/org/hibernate/jpamodelgen/test/mixedmode and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Feb 9 17:12:14 EST 2010
Author: hardy.ferentschik
Date: 2010-02-09 17:12:14 -0500 (Tue, 09 Feb 2010)
New Revision: 18756
Added:
jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/Insurance.java
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/MixedConfigurationTest.java
jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/RentalCar.java
Log:
METAGEN-9 Added support for Embeddable
Modified: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
===================================================================
--- jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java 2010-02-09 21:50:09 UTC (rev 18755)
+++ jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java 2010-02-09 22:12:14 UTC (rev 18756)
@@ -41,6 +41,7 @@
import javax.persistence.AccessType;
import javax.persistence.Basic;
import javax.persistence.ElementCollection;
+import javax.persistence.Embeddable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyClass;
@@ -476,6 +477,9 @@
if ( BASIC_TYPES.contains( typeName ) ) {
return Boolean.TRUE;
}
+ if ( TypeUtils.containsAnnotation( element, Embeddable.class ) ) {
+ return Boolean.TRUE;
+ }
for ( TypeMirror mirror : typeElement.getInterfaces() ) {
TypeElement interfaceElement = ( TypeElement ) context.getProcessingEnvironment()
.getTypeUtils()
Added: jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/Insurance.java
===================================================================
--- jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/Insurance.java (rev 0)
+++ jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/Insurance.java 2010-02-09 22:12:14 UTC (rev 18756)
@@ -0,0 +1,47 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jpamodelgen.test.mixedmode;
+
+import javax.persistence.Embeddable;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Embeddable
+public class Insurance {
+ String number;
+ String policyNumber;
+
+ public String getPolicyNumber() {
+ return policyNumber;
+ }
+
+ public void setPolicyNumber(String policyNumber) {
+ this.policyNumber = policyNumber;
+ }
+
+ public String getNumber() {
+ return number;
+ }
+
+ public void setNumber(String number) {
+ this.number = number;
+ }
+}
+
+
Modified: jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/MixedConfigurationTest.java
===================================================================
--- jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/MixedConfigurationTest.java 2010-02-09 21:50:09 UTC (rev 18755)
+++ jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/MixedConfigurationTest.java 2010-02-09 22:12:14 UTC (rev 18756)
@@ -57,6 +57,9 @@
assertPresenceOfFieldInMetamodelFor(
RentalCar.class, "company", "Property 'company' should be included due to xml configuration"
);
+ assertPresenceOfFieldInMetamodelFor(
+ RentalCar.class, "insurance", "Property 'insurance' should be included since it is an embeddable"
+ );
}
@Override
Modified: jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/RentalCar.java
===================================================================
--- jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/RentalCar.java 2010-02-09 21:50:09 UTC (rev 18755)
+++ jpamodelgen/trunk/src/test/java/org/hibernate/jpamodelgen/test/mixedmode/RentalCar.java 2010-02-09 22:12:14 UTC (rev 18756)
@@ -31,6 +31,8 @@
private Character[] chassisNumber;
+ private Insurance insurance;
+
public RentalCompany getCompany() {
return company;
}
@@ -55,6 +57,14 @@
this.hired = hired;
}
+ public Insurance getInsurance() {
+ return insurance;
+ }
+
+ public void setInsurance(Insurance insurance) {
+ this.insurance = insurance;
+ }
+
enum CURRENTLY_HIRED {
YES, NO
}
More information about the hibernate-commits
mailing list