You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2008/02/15 10:20:40 UTC
svn commit: r627979 [4/39] - in /openjpa/trunk:
openjpa-lib/src/test/java/org/apache/openjpa/lib/test/
openjpa-persistence-jdbc/ openjpa-persistence-jdbc/src/test/java/
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/
openjpa-pers...
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/CallbackStorage.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/CallbackStorage.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/CallbackStorage.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/CallbackStorage.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Singleton class to store callback invocation hits
+ * @author aokeke
+ *
+ */
+public class CallbackStorage
+{
+ private static CallbackStorage store = new CallbackStorage();
+
+ private static List<String> clist = new ArrayList<String>();
+
+ private CallbackStorage()
+ {}
+
+ public static CallbackStorage getInstance()
+ {
+ if(store == null)
+ store = new CallbackStorage();
+ return store;
+ }
+
+ public List<String> getClist() {
+ return clist;
+ }
+
+ public void setClist(List<String> clist) {
+ CallbackStorage.clist = clist;
+ }
+
+ public static void clearStore()
+ {
+ clist = new ArrayList<String>();
+ }
+
+ public static boolean isEmpty()
+ {
+ return clist.isEmpty();
+ }
+
+ public static int size()
+ {
+ return clist.size();
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/ContractEmployee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/ContractEmployee.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/ContractEmployee.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/ContractEmployee.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.ArrayList;
+
+import javax.persistence.*;
+
+@Entity
+@ExcludeSuperclassListeners
+@EntityListeners(LongNameValidator.class)
+public class ContractEmployee extends Employee
+{
+ private int dailyRate;
+ private int term;
+
+ public ContractEmployee(){}
+
+ public ContractEmployee(int id, String name, int dRate, int term)
+ {
+ super(id, name);
+ this.dailyRate = dRate;
+ this.term = term;
+ }
+
+ @PrePersist
+ public void verifyTerm()
+ {
+ System.out.println("VerifyTerm of ContractEmployee running on"+this);
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("contractemployee");
+ }
+
+
+ public int getDailyRate() {
+ return dailyRate;
+ }
+ public void setDailyRate(int dailyRate) {
+ this.dailyRate = dailyRate;
+ }
+ public int getTerm() {
+ return term;
+ }
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DateValidator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DateValidator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DateValidator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DateValidator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+public class DateValidator
+{
+ @PrePersist
+ public void prePersist(Schedule sched)
+ {
+ if(sched.getStartDate() == null)
+ {
+ System.out.println("Date cannot be null");
+ throw new NullPointerException();
+ }
+ }
+
+ @PostPersist
+ public void postPersist(Schedule sched)
+ {
+ System.out.println("Schedule "+sched+" is successfully persisted: DateValidator.class");
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DefaultCallbackListener.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DefaultCallbackListener.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DefaultCallbackListener.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/DefaultCallbackListener.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.PrePersist;
+import javax.persistence.PostPersist;
+import javax.persistence.PreRemove;
+import javax.persistence.PostRemove;
+import javax.persistence.PostUpdate;
+import javax.persistence.PreUpdate;
+import javax.persistence.PostLoad;
+
+public class DefaultCallbackListener
+{
+ public DefaultCallbackListener()
+ {}
+
+ @PrePersist
+ public void prePersist(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-prepersist");
+ }
+
+ @PostPersist
+ public void postPersist(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postpersist");
+ }
+
+ @PostRemove
+ public void postRemove(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postremove");
+ }
+
+ @PreRemove
+ public void preRemove(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-preremove");
+ }
+
+ @PostUpdate
+ public void postUpdate(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postupdate");
+ }
+
+ @PreUpdate
+ public void preUpdate(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-preupdate");
+ }
+
+ @PostLoad
+ public void postLoad(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postload");
+ }
+
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedOwner.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedOwner.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedOwner.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedOwner.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@SqlResultSetMapping(name = "EmbedMapping", entities = {
+@EntityResult(entityClass = EmbedOwner.class, fields = {
+@FieldResult(name = "pk", column = "OWNER_PK"),
+@FieldResult(name = "basic", column = "OWNER_BASIC"),
+@FieldResult(name = "embed.basic", column = "EMBED_BASIC"),
+@FieldResult(name = "embed.clob", column = "EMBED_CLOB")
+ })
+ })
+public class EmbedOwner {
+
+ @Embedded
+ @AttributeOverride(name = "basic", column = @Column(name = "OVER_BASIC"))
+ @AssociationOverride(name = "owner",
+ joinColumns = @JoinColumn(name = "OVER_OWNER"))
+ protected EmbedValue embed;
+
+ @Basic
+ @Column(name = "OWN_BASIC")
+ protected String basic;
+
+ @Id
+ @GeneratedValue
+ protected int pk;
+
+ public int getPk() {
+ return pk;
+ }
+
+ public void setBasic(String basic) {
+ this.basic = basic;
+ }
+
+ public String getBasic() {
+ return basic;
+ }
+
+ public void setEmbed(EmbedValue embed) {
+ this.embed = embed;
+ }
+
+ public EmbedValue getEmbed() {
+ return embed;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Embeddable
+public class EmbedValue {
+
+ @Basic
+ @Column(name = "EMB_BASIC")
+ protected String basic;
+
+ @Lob
+ @Column(name = "EMB_CLOB")
+ protected String clob;
+
+ @Lob
+ @Column(name = "EMB_BLOB")
+ protected byte[] blob;
+
+ @ManyToOne
+ @JoinColumn(name = "EMB_REL")
+ protected EmbedOwner owner;
+
+ public void setBasic(String basic) {
+ this.basic = basic;
+ }
+
+ public String getBasic() {
+ return basic;
+ }
+
+ public void setClob(String clob) {
+ this.clob = clob;
+ }
+
+ public String getClob() {
+ return clob;
+ }
+
+ public void setBlob(byte[] blob) {
+ this.blob = blob;
+ }
+
+ public byte[] getBlob() {
+ return blob;
+ }
+
+ public void setOwner(EmbedOwner owner) {
+ this.owner = owner;
+ }
+
+ public EmbedOwner getOwner() {
+ return owner;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbedValue2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+/**
+ * Same as EmbedValue but no blobs for suitable use as key/value/element
+ * in oracle.
+ */
+@Embeddable
+public class EmbedValue2 {
+
+ @Basic
+ @Column(name = "EMB_BASIC")
+ protected String basic;
+
+ @Basic
+ @Column(name = "EMB_INTBASIC")
+ protected int intBasic;
+
+ public void setBasic(String basic) {
+ this.basic = basic;
+ }
+
+ public String getBasic() {
+ return basic;
+ }
+
+ public void setIntBasic(int intBasic) {
+ this.intBasic = intBasic;
+ }
+
+ public int getIntBasic() {
+ return intBasic;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuper.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuper.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuper.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@MappedSuperclass
+public class EmbeddableSuper {
+
+ @Id
+ @GeneratedValue
+ @Column(name = "ID")
+ private long pk;
+
+ @Version
+ @Column(name = "SUPVERS")
+ private int version;
+
+ @Transient
+ private int trans;
+
+ @Lob
+ @Column(name = "CLOBVAL")
+ protected String clob;
+
+ public EmbeddableSuper() {
+ }
+
+ public long getPK() {
+ return this.pk;
+ }
+
+ public void setPK(long pk) {
+ this.pk = pk;
+ }
+
+ public int getTrans() {
+ return this.trans;
+ }
+
+ public void setTrans(int trans) {
+ this.trans = trans;
+ }
+
+ public String getClob() {
+ return this.clob;
+ }
+
+ public void setClob(String clob) {
+ this.clob = clob;
+ }
+
+ public int getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuperSub.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuperSub.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuperSub.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddableSuperSub.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@DiscriminatorColumn(name = "DISC")
+@AttributeOverrides({
+ @AttributeOverride(name = "clob", column = @Column(name = "CC")),
+ @AttributeOverride(name = "version", column = @Column(name = "VERSVAL"))
+})
+public class EmbeddableSuperSub
+ extends EmbeddableSuper {
+
+ @ManyToOne
+ private EmbeddableSuperSub sub;
+
+ @ManyToOne
+ private EmbeddableSuper sup;
+
+ public EmbeddableSuperSub() {
+ }
+
+ public EmbeddableSuperSub getSub() {
+ return this.sub;
+ }
+
+ public void setSub(EmbeddableSuperSub sub) {
+ this.sub = sub;
+ }
+
+ public EmbeddableSuper getSup() {
+ return this.sup;
+ }
+
+ public void setSup(EmbeddableSuper sup) {
+ this.sup = sup;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdClass.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdClass.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdClass.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdClass.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Embeddable
+public class EmbeddedIdClass {
+
+ @Column(name = "EPK1")
+ private long pk1;
+
+ @Column(name = "EPK2")
+ private long pk2;
+
+ @Column(name = "EPK3")
+ @GeneratedValue
+ private long pk3;
+
+ public long getPk1() {
+ return pk1;
+ }
+
+ public void setPk1(long pk1) {
+ this.pk1 = pk1;
+ }
+
+ public long getPk2() {
+ return pk2;
+ }
+
+ public void setPk2(long pk2) {
+ this.pk2 = pk2;
+ }
+
+ public long getPk3() {
+ return pk3;
+ }
+
+ public void setPk3(long pk3) {
+ this.pk3 = pk3;
+ }
+
+ public String toString() {
+ return pk1 + ":" + pk2 + ":" + pk3;
+ }
+
+ public int hashCode() {
+ return (int) ((pk1 ^ pk2 ^ pk3) % Integer.MAX_VALUE);
+ }
+
+ public boolean equals(Object other) {
+ if (other == this)
+ return true;
+ if (!(other instanceof EmbeddedIdClass))
+ return false;
+
+ EmbeddedIdClass id = (EmbeddedIdClass) other;
+ return id.pk1 == pk1
+ && id.pk2 == pk2
+ && id.pk3 == pk3;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/EmbeddedIdEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "EMIDENTITY")
+@SqlResultSetMapping(name = "EmbeddedIdMapping", entities = {
+@EntityResult(entityClass = EmbeddedIdEntity.class, fields = {
+@FieldResult(name = "id.pk1", column = "OWNER_PK1"),
+@FieldResult(name = "id.pk2", column = "OWNER_PK2"),
+@FieldResult(name = "id.pk3", column = "OWNER_PK3"),
+@FieldResult(name = "value", column = "OWNER_VAL"),
+@FieldResult(name = "relation.id.pk1", column = "REL_PK1"),
+@FieldResult(name = "relation.id.pk2", column = "REL_PK2"),
+@FieldResult(name = "relation.id.pk3", column = "REL_PK3")
+ }),
+@EntityResult(entityClass = EmbeddedIdEntity.class, fields = {
+@FieldResult(name = "id.pk1", column = "REL_PK1"),
+@FieldResult(name = "id.pk2", column = "REL_PK2"),
+@FieldResult(name = "id.pk3", column = "REL_PK3"),
+@FieldResult(name = "value", column = "REL_VAL")
+ })
+ })
+public class EmbeddedIdEntity {
+
+ @EmbeddedId
+ private EmbeddedIdClass id;
+
+ @Column(name = "VAL")
+ private String value;
+
+ @ManyToOne
+ private EmbeddedIdEntity relation;
+
+ @ManyToOne
+ @JoinColumns({
+ @JoinColumn(name = "MREL_PK1", referencedColumnName = "EPK1"),
+ @JoinColumn(name = "MREL_PK2", referencedColumnName = "EPK2")
+ })
+ private EmbeddedIdEntity mapOverrideRelation;
+
+ public EmbeddedIdClass getId() {
+ return id;
+ }
+
+ public void setId(EmbeddedIdClass id) {
+ this.id = id;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public EmbeddedIdEntity getRelation() {
+ return relation;
+ }
+
+ public void setRelation(EmbeddedIdEntity relation) {
+ this.relation = relation;
+ }
+
+ public EmbeddedIdEntity getMappingOverrideRelation() {
+ return mapOverrideRelation;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Employee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Employee.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Employee.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Employee.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@Inheritance(strategy=InheritanceType.JOINED)
+@EntityListeners({NameValidator.class, LongNameValidator.class})
+public class Employee implements NamedEntity
+{
+ @Id
+ private int id;
+
+ @Basic
+ protected String name;
+
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ protected int lifecheck;
+
+ @Transient
+ protected long syncTime;
+
+ public Employee()
+ {}
+
+ public Employee(int id, String name)
+ {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ public int getId()
+ {
+ return id;
+ }
+
+ @PostPersist
+ private void resetSyncTime()
+ {
+ System.out.println("resetSyncTime is running on "+this+"GEN #: "+lifecheck);
+ syncTime = System.currentTimeMillis();
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("employeepop");
+ store.getClist().add("gen#"+lifecheck);
+ }
+
+ @PostLoad
+ public void pload()
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("employeepol");
+ }
+
+ @PostUpdate
+ public void pupdate()
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("employeepou");
+ }
+
+ public String toString()
+ {
+ return "Name: "+name+" of "+this.getClass().getName()+" Id: "+id+" Synctime: "+syncTime;
+ }
+
+ public int getCheck() {
+ return this.lifecheck;
+ }
+
+ public void setCheck(int check) {
+ this.lifecheck = check;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.io.Serializable;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EntityResult;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToOne;
+import javax.persistence.SqlResultSetMapping;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+
+@Entity
+@Table(name="entity_1")
+@Inheritance(strategy=InheritanceType.JOINED)
+@SqlResultSetMapping(name="NativeTestResult", entities=@EntityResult(entityClass=Entity1.class))
+public class Entity1 implements Serializable
+{
+ private static final long serialVersionUID = 2882935803066041165L;
+
+ @Id
+ protected long pk;
+
+ @Basic
+ @Column(length=35)
+ protected String stringField;
+
+ @Basic
+ protected int intField;
+
+ @OneToOne(cascade={CascadeType.REMOVE, CascadeType.PERSIST})
+ protected Entity2 entity2Field;
+
+ @Version
+ protected int versionField;
+
+ public Entity1()
+ {}
+
+ public Entity1 (long pk, String stringField, int intField)
+ {
+ this.pk = pk;
+ this.stringField = stringField;
+ this.intField = intField;
+ }
+
+
+ public long getPk ()
+ {
+ return pk;
+ }
+
+
+ public void setStringField (String val)
+ {
+ stringField = val;
+ }
+
+
+ public String getStringField ()
+ {
+ return stringField;
+ }
+
+
+ public void setIntField (int val)
+ {
+ intField = val;
+ }
+
+
+ public int getIntField ()
+ {
+ return intField;
+ }
+
+
+ public void setEntity2Field (Entity2 val)
+ {
+ entity2Field = val;
+ }
+
+
+ public Entity2 getEntity2Field ()
+ {
+ return entity2Field;
+ }
+
+ public String toString()
+ {
+ return("PK: "+pk+" StringField: "+stringField+" IntField: "+intField);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Entity2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.io.Serializable;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+
+//@Entity(name="entity2ExplicitName")
+@Entity
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+public class Entity2 implements Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4723739219953167343L;
+
+ @Id
+ protected long pk;
+
+ @Basic
+ @Column(length=35)
+ protected String stringField;
+
+ @Basic
+ protected int intField;
+
+ public Entity2()
+ {}
+
+
+ public Entity2 (long pk, String stringField, int intField)
+ {
+ this.pk = pk;
+ this.stringField = stringField;
+ this.intField = intField;
+ }
+
+
+ public long getPk ()
+ {
+ return pk;
+ }
+
+
+ public void setStringField (String val)
+ {
+ stringField = val;
+ }
+
+
+ public String getStringField ()
+ {
+ return stringField;
+ }
+
+ public void setIntField (int val)
+ {
+ intField = val;
+ }
+
+
+ public int getIntField ()
+ {
+ return intField;
+ }
+
+ public String toString()
+ {
+ return("PK: "+pk+" StringField: "+stringField+" IntField: "+intField);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "EJB_CLS")
+public class Flat1 {
+
+ @Id
+ @Column(name = "PK")
+ protected int pk;
+
+ @Version
+ @Column(name = "EJB_VER")
+ protected int version;
+
+ @Basic
+ protected int basic;
+
+ public Flat1() {
+ }
+
+ public Flat1(int pk) {
+ this.pk = pk;
+ }
+
+ public void setPk(int val) {
+ pk = val;
+ }
+
+ public int getPk() {
+ return pk;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public void setBasic(int i) {
+ basic = i;
+ }
+
+ public int getBasic() {
+ return basic;
+ }
+}
+
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Flat2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+public class Flat2
+ extends Flat1 {
+
+ @Basic
+ protected String basic2;
+
+ public Flat2() {
+ }
+
+ public Flat2(int pk) {
+ super(pk);
+ }
+
+ public void setBasic2(String s) {
+ basic2 = s;
+ }
+
+ public String getBasic2() {
+ return basic2;
+ }
+}
+
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/FlightSchedule.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/FlightSchedule.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/FlightSchedule.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/FlightSchedule.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+import java.util.*;
+
+@Entity
+@DiscriminatorValue("fsched")
+@Table(name="Flight_Sched",
+ uniqueConstraints=@UniqueConstraint(columnNames={"planeName"}))
+public class FlightSchedule extends Schedule
+{
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ private int FlightNum;
+
+ @Column(nullable=false)
+ private String planeName;
+
+ public FlightSchedule(){}
+
+ public FlightSchedule(String name, Calendar cad, Date start, Date end, String pname)
+ {
+ super(name, cad, start, end);
+ this.planeName = pname;
+ }
+
+ public String getFlightName() {
+ return planeName;
+ }
+
+ public void setFlightName(String flightName) {
+ planeName = flightName;
+ }
+
+ public int getFlightNum() {
+ return FlightNum;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.*;
+
+import javax.persistence.*;
+
+@Entity
+// non-psql/ora dbs cause issues with SequenceGenerator in auto-mapping
+//@SequenceGenerator(name="seq", sequenceName="ejb_sequence")
+@TableGenerator(name = "tab")
+@IdClass(Generator.Oid.class)
+public class Generator {
+
+ @Id
+ protected int pk;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "tab")
+ protected Integer pk2;
+
+ @Id
+ @GeneratedValue
+ protected long pk3;
+
+ @Basic
+ protected String stringField;
+
+ // for non-seq
+ public void setPk(int pk) {
+ this.pk = pk;
+ }
+
+ public int getPk() {
+ return pk;
+ }
+
+ public Integer getPk2() {
+ return pk2;
+ }
+
+ public long getPk3() {
+ return pk3;
+ }
+
+ public String getStringField() {
+ return stringField;
+ }
+
+ public void setStringField(String s) {
+ stringField = s;
+ }
+
+ public static class Oid {
+
+ public int pk;
+ public Integer pk2;
+ public long pk3;
+
+ public Oid() {
+ }
+
+ public Oid(String str) {
+ StringTokenizer tok = new StringTokenizer(str, ",");
+ pk = Integer.parseInt(tok.nextToken());
+ pk2 = Integer.valueOf(tok.nextToken());
+ pk3 = Long.valueOf(tok.nextToken());
+ }
+
+ public boolean equals(Object o) {
+ if (o == null || !(o instanceof Oid))
+ return false;
+ Oid other = (Oid) o;
+ if (pk != other.pk)
+ return false;
+ if (pk3 != other.pk3)
+ return false;
+ if (pk2 == null)
+ return other.pk2 == null;
+ return pk2.equals(other.pk2);
+ }
+
+ public int hashCode() {
+ return pk + (pk2 == null ? 0 : pk2.hashCode())
+ + (int) (pk3 % Integer.MAX_VALUE);
+ }
+
+ public String toString() {
+ return pk + "," + pk2 + "," + pk3;
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/LongNameValidator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/LongNameValidator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/LongNameValidator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/LongNameValidator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+public class LongNameValidator
+{
+ @PrePersist
+ public void validateName(NamedEntity obj)
+ {
+ System.out.println("LongNameValidator is running on "+obj);
+ if(obj.getName().equals("") || obj.getName() == null)
+ throw new NullPointerException();
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("longnamevalidatorprr");
+ }
+
+ @PostUpdate
+ public void testpost(NamedEntity obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("longnamevalidatorpou");
+ }
+
+
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NameValidator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NameValidator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NameValidator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NameValidator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+public class NameValidator
+{
+ @PrePersist
+ public void validateName(NamedEntity obj)
+ {
+ System.out.println("NameValidator is running on "+obj);
+ if(obj.getName().equals("") || obj.getName() == null)
+ throw new NullPointerException();
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("namevalidator");
+ }
+
+ @PostUpdate
+ public void testpost(NamedEntity obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("namevalidatorpou");
+ }
+
+ @PostRemove
+ public void validateNothing(NamedEntity obj)
+ {
+ System.out.println("NameValidator is running on ");
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("namevalidatorpor");
+ }
+
+ @PreRemove
+ public void validateNothing1(NamedEntity obj)
+ {
+ System.out.println("NameValidator is running on ");
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("namevalidatorprr");
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NamedEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NamedEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NamedEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/NamedEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+
+public interface NamedEntity
+{
+ public String getName();
+
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/OrderByEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/OrderByEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/OrderByEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/OrderByEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.*;
+
+import javax.persistence.*;
+
+import org.apache.openjpa.persistence.*;
+
+/**
+ * <p>Entity used to test parsing of @OrderBy.</p>
+ *
+ * @author Abe White
+ */
+@Entity
+public class OrderByEntity {
+
+ @Id
+ private long id;
+ private String string;
+
+ @PersistentCollection
+ @OrderBy
+ private List<String> strings = new ArrayList();
+
+ @ManyToMany
+ @OrderBy
+ @JoinTable(name = "ORDERBY_PKRELS",
+ inverseJoinColumns = @JoinColumn(name = "REL_ID",
+ referencedColumnName = "ID"))
+ private List<OrderByEntity> pkRels = new ArrayList();
+
+ @ManyToMany
+ @OrderBy("string desc")
+ @JoinTable(name = "ORDERBY_STRINGRELS",
+ inverseJoinColumns = @JoinColumn(name = "REL_ID",
+ referencedColumnName = "ID"))
+ private List<OrderByEntity> stringRels = new ArrayList();
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getString() {
+ return this.string;
+ }
+
+ public void setString(String string) {
+ this.string = string;
+ }
+
+ public List<String> getStrings() {
+ return this.strings;
+ }
+
+ public List<OrderByEntity> getPKRels() {
+ return this.pkRels;
+ }
+
+ public List<OrderByEntity> getStringRels() {
+ return this.stringRels;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PropertyAccess1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PropertyAccess1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PropertyAccess1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PropertyAccess1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+/**
+ * Entity test object that uses property access mode.
+ */
+@Entity
+public class PropertyAccess1 {
+
+ private int id;
+ private String name;
+ private int intVal; // this intentionally does not match the getter name
+
+ protected PropertyAccess1() {
+ }
+
+ public PropertyAccess1(int id) {
+ this.id = id;
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String n) {
+ this.name = n;
+ }
+
+ public int getIntValue() {
+ return intVal;
+ }
+
+ public void setIntValue(int intVal) {
+ this.intVal = intVal;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Schedule.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Schedule.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Schedule.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Schedule.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.Date;
+import java.util.Calendar;
+
+import javax.persistence.*;
+
+@Entity
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+@EntityListeners({DateValidator.class, StringValidator.class})
+public class Schedule
+{
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ private int id;
+
+ @Temporal(TemporalType.DATE)
+ @Basic(fetch=FetchType.EAGER)
+ private Calendar dob;
+
+ @Temporal(TemporalType.TIME)
+ @Basic
+ private Date startDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Basic
+ private Date endDate;
+
+ @Basic
+ private String name;
+
+ public Schedule(){}
+
+ public Schedule(String name, Calendar cad, Date sdate, Date endDate)
+ {
+ this.name = name;
+ this.dob = cad;
+ this.startDate = sdate;
+ this.endDate = endDate;
+ }
+
+ public Calendar getDob() {
+ return dob;
+ }
+
+ public void setDob(Calendar dob) {
+ this.dob = dob;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ return "Schedule "+name+" Date "+startDate;
+ }
+
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/StringValidator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/StringValidator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/StringValidator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/StringValidator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+public class StringValidator
+{
+ @PrePersist
+ public void prePersist(FlightSchedule sched)
+ {
+ if(sched.getName().length() == 0 || sched.getName().equals(""))
+ throw new IllegalArgumentException("Needs a valid name");
+ }
+
+ @PostPersist
+ public void postPersist(FlightSchedule sched)
+ {
+ System.out.println("Schedule "+sched+" is successfully persisted: StringValidator.class");
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class TablePerClass1 {
+
+ @Id
+ @GeneratedValue
+ protected int pk;
+
+ @Column(name = "TPC_BASIC")
+ protected int basic;
+
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "basic",
+ column = @Column(name = "TPC_EMB_BASIC")),
+ @AttributeOverride(name = "clob", column = @Column(name = "TPC_EMB_CLOB")),
+ @AttributeOverride(name = "blob", column = @Column(name = "TPC_EMB_BLOB"))
+ })
+ protected EmbedValue embed;
+
+ public int getPk() {
+ return pk;
+ }
+
+ public void setBasic(int i) {
+ basic = i;
+ }
+
+ public int getBasic() {
+ return basic;
+ }
+
+ public EmbedValue getEmbed() {
+ return embed;
+ }
+
+ public void setEmbed(EmbedValue ev) {
+ embed = ev;
+ }
+}
+
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TablePerClass2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.*;
+
+@Entity
+public class TablePerClass2
+ extends TablePerClass1 {
+
+ @Basic
+ protected String basic2;
+
+ public void setBasic2(String s) {
+ basic2 = s;
+ }
+
+ public String getBasic2() {
+ return basic2;
+ }
+}
+
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TxRollbackEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TxRollbackEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TxRollbackEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/TxRollbackEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype;
+
+import java.util.ArrayList;
+
+import javax.persistence.Basic;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PostLoad;
+import javax.persistence.PostPersist;
+import javax.persistence.Entity;
+import javax.persistence.PostRemove;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="TX_ROLLBACK_ENT")
+public class TxRollbackEntity
+{
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Id
+ private int id;
+
+ @Basic
+ private String name;
+
+ public TxRollbackEntity(String name)
+ {
+ this.name = name;
+ }
+
+ @PostLoad
+ public void rollBackException()
+ {
+ //should throw a null pointer exception causing the tx to be rolled back
+ ArrayList<Integer> list = null;
+ list.add(1);
+ }
+
+ @PostRemove
+ public void bomb()
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("rollbackpor1");
+ }
+
+ public void bomb2()
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("rollbackpor");
+ }
+
+ public int getId() {
+ return id;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/CallbackStorage.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/CallbackStorage.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/CallbackStorage.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/CallbackStorage.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Singleton class to store callback invocation hits
+ * @author aokeke
+ *
+ */
+public class CallbackStorage
+{
+ private static CallbackStorage store = new CallbackStorage();
+
+ private static List<String> clist = new ArrayList<String>();
+
+ private CallbackStorage()
+ {}
+
+ public static CallbackStorage getInstance()
+ {
+ if(store == null)
+ store = new CallbackStorage();
+ return store;
+ }
+
+ public List<String> getClist() {
+ return clist;
+ }
+
+ public void setClist(List<String> clist) {
+ CallbackStorage.clist = clist;
+ }
+
+ public static void clearStore()
+ {
+ clist = new ArrayList<String>();
+ }
+
+ public static boolean isEmpty()
+ {
+ return clist.isEmpty();
+ }
+
+ public static int size()
+ {
+ return clist.size();
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/ContractEmployee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/ContractEmployee.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/ContractEmployee.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/ContractEmployee.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype;
+
+import java.util.ArrayList;
+
+import javax.persistence.*;
+
+@Entity
+@ExcludeSuperclassListeners
+@EntityListeners(LongNameValidator.class)
+public class ContractEmployee extends Employee
+{
+ private int dailyRate;
+ private int term;
+
+ public ContractEmployee(){}
+
+ public ContractEmployee(int id, String name, int dRate, int term)
+ {
+ super(id, name);
+ this.dailyRate = dRate;
+ this.term = term;
+ }
+
+ @PrePersist
+ public void verifyTerm()
+ {
+ System.out.println("VerifyTerm of ContractEmployee running on"+this);
+
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("contractemployee");
+ }
+
+
+ public int getDailyRate() {
+ return dailyRate;
+ }
+ public void setDailyRate(int dailyRate) {
+ this.dailyRate = dailyRate;
+ }
+ public int getTerm() {
+ return term;
+ }
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DateValidator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DateValidator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DateValidator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DateValidator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype;
+
+import javax.persistence.*;
+
+public class DateValidator
+{
+ @PrePersist
+ public void prePersist(Schedule sched)
+ {
+ if(sched.getStartDate() == null)
+ {
+ System.out.println("Date cannot be null");
+ throw new NullPointerException();
+ }
+ }
+
+ @PostPersist
+ public void postPersist(Schedule sched)
+ {
+ System.out.println("Schedule "+sched+" is successfully persisted: DateValidator.class");
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DefaultCallbackListener.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DefaultCallbackListener.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DefaultCallbackListener.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/ddtype/DefaultCallbackListener.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype;
+
+import javax.persistence.PrePersist;
+import javax.persistence.PostPersist;
+import javax.persistence.PreRemove;
+import javax.persistence.PostRemove;
+import javax.persistence.PostUpdate;
+import javax.persistence.PreUpdate;
+import javax.persistence.PostLoad;
+
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype.CallbackStorage;
+
+public class DefaultCallbackListener
+{
+ public DefaultCallbackListener()
+ {}
+
+// @PrePersist
+ public void prePersist(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-prepersist");
+ }
+
+// @PostPersist
+ public void postPersist(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postpersist");
+ }
+
+// @PostRemove
+ public void postRemove(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postremove");
+ }
+
+// @PreRemove
+ public void preRemove(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-preremove");
+ }
+
+// @PostUpdate
+ public void postUpdate(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postupdate");
+ }
+
+// @PreUpdate
+ public void preUpdate(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-preupdate");
+ }
+
+// @PostLoad
+ public void postLoad(Object obj)
+ {
+ CallbackStorage store = CallbackStorage.getInstance();
+ store.getClist().add("def-postload");
+ }
+
+}