From 562b4942df21464b85b1a040019dde5936c06f0e Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Mon, 28 Sep 2009 14:36:49 +0000 Subject: [PATCH] OPENJPA-1115: Setting svn:eol-style native on new files git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@819560 13f79535-47bb-0310-9956-ffa450edef68 --- .../identifiers/noschema/EntityC.java | 362 +++++++-------- .../identifiers/noschema/EntityD.java | 178 ++++---- .../identifiers/noschema/EntityD2.java | 174 +++---- .../identifiers/noschema/EntityD3.java | 130 +++--- .../identifiers/noschema/EntityD4.java | 130 +++--- .../identifiers/noschema/EntityE.java | 138 +++--- .../identifiers/noschema/EntityF.java | 424 +++++++++--------- .../identifiers/noschema/EntityG.java | 136 +++--- .../noschema/TestNoSchemaManualDelimId.java | 266 +++++------ .../TestNoSchemaManualDelimIdSeqGen.java | 238 +++++----- ...oSchemaManualDelimitedJoinAnnotations.java | 338 +++++++------- 11 files changed, 1257 insertions(+), 1257 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java index c4a046b73..ffb68015a 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java @@ -1,181 +1,181 @@ -/* - * 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.delimited.identifiers.noschema; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.MapKeyJoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.SecondaryTable; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity c\"") -@SecondaryTable(name="\"sec join table\"", - pkJoinColumns=@PrimaryKeyJoinColumn(name="\"entity c\"", - referencedColumnName="\"c id\"")) -public class EntityC { - @Id - @Column(name="\"c id\"") - private int id; - private String name; - - @Column(table="\"sec join table\"") - private String secName; - - @ManyToMany - @JoinTable(name="\"c d\"") - private Collection entityDs = new HashSet(); - - @OneToOne - @JoinColumn(name="\"entd2 id\"", referencedColumnName="\"entityD2 id\"") - private EntityD2 entityD2; - - @ManyToMany - @JoinTable(name="\"map join table\"") - @MapKeyJoinColumn(name="map_ed3", referencedColumnName="\"entityD3 id\"") - Map map = new HashMap(); - - @ManyToMany - @JoinTable(name="\"map2 join table\"") - @MapKeyJoinColumn(name="\"map ed4\"", - referencedColumnName="\"entityD4 id\"") - Map map2 = new HashMap(); - - public EntityC() {} - - public EntityC(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - /** - * @return the entityDs - */ - public Collection getEntityDs() { - return entityDs; - } - /** - * @param entityDs the entityDs to set - */ - public void setEntityDs(Collection entityDs) { - this.entityDs = entityDs; - } - - public void addEntityD(EntityD entityD) { - entityDs.add(entityD); - } - - /** - * @return the entityD2 - */ - public EntityD2 getEntityD2() { - return entityD2; - } - - /** - * @param entityD2 the entityD2 to set - */ - public void setEntityD2(EntityD2 entityD2) { - this.entityD2 = entityD2; - } - - /** - * @return the map - */ - public Map getMap() { - return map; - } - - /** - * @param map the map to set - */ - public void setMap(Map map) { - this.map = map; - } - - public void addMapValues(EntityD3 key, EntityD4 value) { - map.put(key, value); - } - - /** - * @return the map2 - */ - public Map getMap2() { - return map2; - } - - /** - * @param map2 the map2 to set - */ - public void setMap2(Map map2) { - this.map2 = map2; - } - - public void addMap2Values(EntityD4 key, EntityD3 value) { - map2.put(key, value); - } - - /** - * @return the secName - */ - public String getSecName() { - return secName; - } - - /** - * @param secName the secName to set - */ - public void setSecName(String secName) { - this.secName = secName; - } -} +/* + * 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.delimited.identifiers.noschema; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.MapKeyJoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.SecondaryTable; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity c\"") +@SecondaryTable(name="\"sec join table\"", + pkJoinColumns=@PrimaryKeyJoinColumn(name="\"entity c\"", + referencedColumnName="\"c id\"")) +public class EntityC { + @Id + @Column(name="\"c id\"") + private int id; + private String name; + + @Column(table="\"sec join table\"") + private String secName; + + @ManyToMany + @JoinTable(name="\"c d\"") + private Collection entityDs = new HashSet(); + + @OneToOne + @JoinColumn(name="\"entd2 id\"", referencedColumnName="\"entityD2 id\"") + private EntityD2 entityD2; + + @ManyToMany + @JoinTable(name="\"map join table\"") + @MapKeyJoinColumn(name="map_ed3", referencedColumnName="\"entityD3 id\"") + Map map = new HashMap(); + + @ManyToMany + @JoinTable(name="\"map2 join table\"") + @MapKeyJoinColumn(name="\"map ed4\"", + referencedColumnName="\"entityD4 id\"") + Map map2 = new HashMap(); + + public EntityC() {} + + public EntityC(int id) { + this.id = id; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + /** + * @return the entityDs + */ + public Collection getEntityDs() { + return entityDs; + } + /** + * @param entityDs the entityDs to set + */ + public void setEntityDs(Collection entityDs) { + this.entityDs = entityDs; + } + + public void addEntityD(EntityD entityD) { + entityDs.add(entityD); + } + + /** + * @return the entityD2 + */ + public EntityD2 getEntityD2() { + return entityD2; + } + + /** + * @param entityD2 the entityD2 to set + */ + public void setEntityD2(EntityD2 entityD2) { + this.entityD2 = entityD2; + } + + /** + * @return the map + */ + public Map getMap() { + return map; + } + + /** + * @param map the map to set + */ + public void setMap(Map map) { + this.map = map; + } + + public void addMapValues(EntityD3 key, EntityD4 value) { + map.put(key, value); + } + + /** + * @return the map2 + */ + public Map getMap2() { + return map2; + } + + /** + * @param map2 the map2 to set + */ + public void setMap2(Map map2) { + this.map2 = map2; + } + + public void addMap2Values(EntityD4 key, EntityD3 value) { + map2.put(key, value); + } + + /** + * @return the secName + */ + public String getSecName() { + return secName; + } + + /** + * @param secName the secName to set + */ + public void setSecName(String secName) { + this.secName = secName; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java index 8428a346a..cba91fe17 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java @@ -1,89 +1,89 @@ -/* - * 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.delimited.identifiers.noschema; - -import java.util.Collection; -import java.util.HashSet; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToMany; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity d\"") -public class EntityD { - @Id - private int id; - private String name; - @ManyToMany(mappedBy="entityDs") - private Collection entityCs = new HashSet(); - - public EntityD() {} - - public EntityD(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the entityCs - */ - public Collection getEntityCs() { - return entityCs; - } - - /** - * @param entityCs the entityCs to set - */ - public void setEntityCs(Collection entityCs) { - this.entityCs = entityCs; - } - - public void addEntityC(EntityC entityC) { - entityCs.add(entityC); - } -} +/* + * 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.delimited.identifiers.noschema; + +import java.util.Collection; +import java.util.HashSet; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity d\"") +public class EntityD { + @Id + private int id; + private String name; + @ManyToMany(mappedBy="entityDs") + private Collection entityCs = new HashSet(); + + public EntityD() {} + + public EntityD(int id) { + this.id = id; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the entityCs + */ + public Collection getEntityCs() { + return entityCs; + } + + /** + * @param entityCs the entityCs to set + */ + public void setEntityCs(Collection entityCs) { + this.entityCs = entityCs; + } + + public void addEntityC(EntityC entityC) { + entityCs.add(entityC); + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java index 7289be549..4e1485f55 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java @@ -1,87 +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.delimited.identifiers.noschema; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToOne; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity d2\"") -public class EntityD2 { - @Id - @Column(name="\"entityD2 id\"") - private int id; - private String name; - - @OneToOne - @PrimaryKeyJoinColumn - private EntityD3 entityD3; - - public EntityD2() {} - - public EntityD2(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the entityD3 - */ - public EntityD3 getEntityD3() { - return entityD3; - } - - /** - * @param entityD3 the entityD3 to set - */ - public void setEntityD3(EntityD3 entityD3) { - this.entityD3 = entityD3; - } -} +/* + * 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.delimited.identifiers.noschema; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToOne; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity d2\"") +public class EntityD2 { + @Id + @Column(name="\"entityD2 id\"") + private int id; + private String name; + + @OneToOne + @PrimaryKeyJoinColumn + private EntityD3 entityD3; + + public EntityD2() {} + + public EntityD2(int id) { + this.id = id; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the entityD3 + */ + public EntityD3 getEntityD3() { + return entityD3; + } + + /** + * @param entityD3 the entityD3 to set + */ + public void setEntityD3(EntityD3 entityD3) { + this.entityD3 = entityD3; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java index 34ec59067..62e58c8af 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java @@ -1,65 +1,65 @@ -/* - * 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.delimited.identifiers.noschema; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity d3\"") -public class EntityD3 { - @Id - @Column(name="\"entityD3 id\"") - int id; - String name; - - public EntityD3() {} - - public EntityD3(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - -} +/* + * 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.delimited.identifiers.noschema; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity d3\"") +public class EntityD3 { + @Id + @Column(name="\"entityD3 id\"") + int id; + String name; + + public EntityD3() {} + + public EntityD3(int id) { + this.id = id; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java index 9fd876999..f9d8564a0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java @@ -1,65 +1,65 @@ -/* - * 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.delimited.identifiers.noschema; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity d4\"") -public class EntityD4 { - @Id - @Column(name="\"entityD4 id\"") - int id; - String name; - - public EntityD4() {} - - public EntityD4(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - -} +/* + * 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.delimited.identifiers.noschema; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity d4\"") +public class EntityD4 { + @Id + @Column(name="\"entityD4 id\"") + int id; + String name; + + public EntityD4() {} + + public EntityD4(int id) { + this.id = id; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java index 1ab2a7153..440be9f8d 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java @@ -1,69 +1,69 @@ -/* - * 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.delimited.identifiers.noschema; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -@Entity -@Table(name="\"primary entityE\"") -public class EntityE { - @Id - @SequenceGenerator(name="entityE_seq_gen_name", - sequenceName="\"entityE_seq_gen\"") - @GeneratedValue(strategy=GenerationType.SEQUENCE, - generator="entityE_seq_gen_name") - private int id; - @Column(name="e_name") - private String name; - - public EntityE(String name) { - this.name = name; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } -} +/* + * 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.delimited.identifiers.noschema; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@Table(name="\"primary entityE\"") +public class EntityE { + @Id + @SequenceGenerator(name="entityE_seq_gen_name", + sequenceName="\"entityE_seq_gen\"") + @GeneratedValue(strategy=GenerationType.SEQUENCE, + generator="entityE_seq_gen_name") + private int id; + @Column(name="e_name") + private String name; + + public EntityE(String name) { + this.name = name; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java index 92b0ab4d0..5022f39c6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java @@ -1,212 +1,212 @@ -/* - * 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.delimited.identifiers.noschema; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.MapKeyColumn; -import javax.persistence.SecondaryTable; -import javax.persistence.Table; -import javax.persistence.TableGenerator; -import javax.persistence.UniqueConstraint; - -@Entity -@Table(name="\"primary entityF\"", - uniqueConstraints= - @UniqueConstraint(columnNames={"\"f name\"", "f_nonDelimName"})) -@SecondaryTable(name="\"secondary entityF\"", - uniqueConstraints= - @UniqueConstraint(name="\"sec_unq\"", - columnNames={"\"secondary name\""})) -public class EntityF { - @TableGenerator(name = "f_id_gen", table = "\"f_id_gen\"", - pkColumnName = "\"gen_pk\"", valueColumnName = "\"gen_value\"") - @GeneratedValue(strategy = GenerationType.TABLE, generator = "f_id_gen") - @Id - private int id; - // Note: Delimited columnDefinition is not supported on some DBs - // TODO: copy into a separate entity and conditionally run a different test - @Column(name="\"f name\"", columnDefinition="varchar(15)") - private String name; - @Column(name="f_nonDelimName") - private String nonDelimName; - @Column(name="\"secondary name\"", table="\"secondary entityF\"") - private String secName; - - @ElementCollection - // CollectionTable with default name generation - @CollectionTable - private Set collectionSet = new HashSet(); - - @ElementCollection - @CollectionTable(name="\"collectionDelimSet\"") - private Set collectionDelimSet = new HashSet(); - - @ElementCollection - // MapKeyColumn with default name generation - @MapKeyColumn - private Map collectionMap = new HashMap(); - - @ElementCollection - // Note: Delimited column definition is not supported on some DBs, so - // it is not delimited here - // TODO: create a separate entity and conditionally run the test on a supported DB - @MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"") - private Map delimCollectionMap = - new HashMap(); - - public EntityF(String name) { - this.name = name; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the nonDelimName - */ - public String getNonDelimName() { - return nonDelimName; - } - - /** - * @param nonDelimName the nonDelimName to set - */ - public void setNonDelimName(String nonDelimName) { - this.nonDelimName = nonDelimName; - } - - /** - * @return the secName - */ - public String getSecName() { - return secName; - } - - /** - * @param secName the secName to set - */ - public void setSecName(String secName) { - this.secName = secName; - } - - /** - * @return the collectionSet - */ - public Set getCollectionSet() { - return collectionSet; - } - - /** - * @param collectionSet the collectionSet to set - */ - public void setCollectionSet(Set collectionSet) { - this.collectionSet = collectionSet; - } - - public void addCollectionSet(String item) { - collectionSet.add(item); - } - - /** - * @return the collectionNamedSet - */ - public Set getCollectionDelimSet() { - return collectionDelimSet; - } - - /** - * @param collectionNamedSet the collectionNamedSet to set - */ - public void setCollectionDelimSet(Set collectionDelimSet) { - this.collectionDelimSet = collectionDelimSet; - } - - public void addCollectionDelimSet(String item) { - this.collectionDelimSet.add(item); - } - - /** - * @return the collectionMap - */ - public Map getCollectionMap() { - return collectionMap; - } - - /** - * @param collectionMap the collectionMap to set - */ - public void setCollectionMap(Map collectionMap) { - this.collectionMap = collectionMap; - } - - public void addCollectionMap(String key, String value) { - collectionMap.put(key, value); - } - - /** - * @return the delimCollectionMap - */ - public Map getDelimCollectionMap() { - return delimCollectionMap; - } - - /** - * @param delimCollectionMap the delimCollectionMap to set - */ - public void setDelimCollectionMap(Map delimCollectionMap) { - this.delimCollectionMap = delimCollectionMap; - } - - public void addDelimCollectionMap(String key, String value) { - delimCollectionMap.put(key, value); - } -} +/* + * 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.delimited.identifiers.noschema; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MapKeyColumn; +import javax.persistence.SecondaryTable; +import javax.persistence.Table; +import javax.persistence.TableGenerator; +import javax.persistence.UniqueConstraint; + +@Entity +@Table(name="\"primary entityF\"", + uniqueConstraints= + @UniqueConstraint(columnNames={"\"f name\"", "f_nonDelimName"})) +@SecondaryTable(name="\"secondary entityF\"", + uniqueConstraints= + @UniqueConstraint(name="\"sec_unq\"", + columnNames={"\"secondary name\""})) +public class EntityF { + @TableGenerator(name = "f_id_gen", table = "\"f_id_gen\"", + pkColumnName = "\"gen_pk\"", valueColumnName = "\"gen_value\"") + @GeneratedValue(strategy = GenerationType.TABLE, generator = "f_id_gen") + @Id + private int id; + // Note: Delimited columnDefinition is not supported on some DBs + // TODO: copy into a separate entity and conditionally run a different test + @Column(name="\"f name\"", columnDefinition="varchar(15)") + private String name; + @Column(name="f_nonDelimName") + private String nonDelimName; + @Column(name="\"secondary name\"", table="\"secondary entityF\"") + private String secName; + + @ElementCollection + // CollectionTable with default name generation + @CollectionTable + private Set collectionSet = new HashSet(); + + @ElementCollection + @CollectionTable(name="\"collectionDelimSet\"") + private Set collectionDelimSet = new HashSet(); + + @ElementCollection + // MapKeyColumn with default name generation + @MapKeyColumn + private Map collectionMap = new HashMap(); + + @ElementCollection + // Note: Delimited column definition is not supported on some DBs, so + // it is not delimited here + // TODO: create a separate entity and conditionally run the test on a supported DB + @MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"") + private Map delimCollectionMap = + new HashMap(); + + public EntityF(String name) { + this.name = name; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the nonDelimName + */ + public String getNonDelimName() { + return nonDelimName; + } + + /** + * @param nonDelimName the nonDelimName to set + */ + public void setNonDelimName(String nonDelimName) { + this.nonDelimName = nonDelimName; + } + + /** + * @return the secName + */ + public String getSecName() { + return secName; + } + + /** + * @param secName the secName to set + */ + public void setSecName(String secName) { + this.secName = secName; + } + + /** + * @return the collectionSet + */ + public Set getCollectionSet() { + return collectionSet; + } + + /** + * @param collectionSet the collectionSet to set + */ + public void setCollectionSet(Set collectionSet) { + this.collectionSet = collectionSet; + } + + public void addCollectionSet(String item) { + collectionSet.add(item); + } + + /** + * @return the collectionNamedSet + */ + public Set getCollectionDelimSet() { + return collectionDelimSet; + } + + /** + * @param collectionNamedSet the collectionNamedSet to set + */ + public void setCollectionDelimSet(Set collectionDelimSet) { + this.collectionDelimSet = collectionDelimSet; + } + + public void addCollectionDelimSet(String item) { + this.collectionDelimSet.add(item); + } + + /** + * @return the collectionMap + */ + public Map getCollectionMap() { + return collectionMap; + } + + /** + * @param collectionMap the collectionMap to set + */ + public void setCollectionMap(Map collectionMap) { + this.collectionMap = collectionMap; + } + + public void addCollectionMap(String key, String value) { + collectionMap.put(key, value); + } + + /** + * @return the delimCollectionMap + */ + public Map getDelimCollectionMap() { + return delimCollectionMap; + } + + /** + * @param delimCollectionMap the delimCollectionMap to set + */ + public void setDelimCollectionMap(Map delimCollectionMap) { + this.delimCollectionMap = delimCollectionMap; + } + + public void addDelimCollectionMap(String key, String value) { + delimCollectionMap.put(key, value); + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java index 82678cc7f..5c2bf8fdd 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java @@ -1,68 +1,68 @@ -/* - * 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.delimited.identifiers.noschema; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="\"entity d4\"") -public class EntityG { - @Id - int id; - String name; - - public EntityG() {} - - public EntityG(int id) { - this.id = id; - } - - public EntityG(int id, String name) { - this.id = id; - this.name = name; - } - - /** - * @return the id - */ - public int getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(int id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - -} +/* + * 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.delimited.identifiers.noschema; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="\"entity d4\"") +public class EntityG { + @Id + int id; + String name; + + public EntityG() {} + + public EntityG(int id) { + this.id = id; + } + + public EntityG(int id, String name) { + this.id = id; + this.name = name; + } + + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java index 6339bd372..d688ad2a8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java @@ -1,133 +1,133 @@ -/* - * 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.delimited.identifiers.noschema; - -import java.util.List; - -import javax.persistence.Query; - -import org.apache.openjpa.jdbc.conf.JDBCConfiguration; -import org.apache.openjpa.jdbc.sql.DB2Dictionary; -import org.apache.openjpa.jdbc.sql.DBDictionary; -import org.apache.openjpa.jdbc.sql.DerbyDictionary; -import org.apache.openjpa.jdbc.sql.MySQLDictionary; -import org.apache.openjpa.jdbc.sql.OracleDictionary; -import org.apache.openjpa.persistence.OpenJPAEntityManager; -import org.apache.openjpa.persistence.test.AllowFailure; -import org.apache.openjpa.persistence.test.SQLListenerTestCase; - -@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + - "order issues are resolved.") -public class TestNoSchemaManualDelimId extends SQLListenerTestCase { - OpenJPAEntityManager em; - EntityF entityF; - - @Override - public void setUp() throws Exception { - - // TODO: Delimiter support is currently limited to database that use - // double quote as a delimiter. - // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase - // is resolved. - setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); - if (isTestsDisabled()) - return; - - super.setUp( - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityF.class, - DROP_TABLES); - assertNotNull(emf); - - em = emf.createEntityManager(); - assertNotNull(em); - } - - public void createEntityF() { - entityF = new EntityF("fName"); - entityF.setNonDelimName("fNonDelimName"); - entityF.setSecName("sec name"); - entityF.addCollectionSet("xxx"); - entityF.addCollectionSet("yyy"); - entityF.addCollectionDelimSet("aaa"); - entityF.addCollectionDelimSet("bbb"); - entityF.addCollectionMap("aaa", "xxx"); - entityF.addCollectionMap("bbb", "yyy"); - entityF.addDelimCollectionMap("www", "xxx"); - entityF.addDelimCollectionMap("yyy", "zzz"); - } - - public void testCreateF() { - createEntityF(); - - em.getTransaction().begin(); - em.persist(entityF); - em.getTransaction().commit(); - - runQueries(); - - } - - // Run a second time to re-create a situation that initially caused a problem when running this - // test consecutive times. - public void testCreateF2() { - createEntityF(); - - em.getTransaction().begin(); - em.persist(entityF); - em.getTransaction().commit(); - } - - private void runQueries() { - em.clear(); - queryOnEntityOnly(); - em.clear(); - queryOnColumnValue(); - em.clear(); - queryCollection(); - } - - private void queryOnEntityOnly() { - String query = - "SELECT DISTINCT f " + - "FROM EntityF f"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - private void queryOnColumnValue() { - String query = - "SELECT DISTINCT f " + - "FROM EntityF f " + - "WHERE f.name = 'fName'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - private void queryCollection() { - String query = - "SELECT DISTINCT f " + - "FROM EntityF f, IN(f.collectionDelimSet) s " + - "WHERE s = 'aaa'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } -} +/* + * 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.delimited.identifiers.noschema; + +import java.util.List; + +import javax.persistence.Query; + +import org.apache.openjpa.jdbc.conf.JDBCConfiguration; +import org.apache.openjpa.jdbc.sql.DB2Dictionary; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.jdbc.sql.DerbyDictionary; +import org.apache.openjpa.jdbc.sql.MySQLDictionary; +import org.apache.openjpa.jdbc.sql.OracleDictionary; +import org.apache.openjpa.persistence.OpenJPAEntityManager; +import org.apache.openjpa.persistence.test.AllowFailure; +import org.apache.openjpa.persistence.test.SQLListenerTestCase; + +@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + + "order issues are resolved.") +public class TestNoSchemaManualDelimId extends SQLListenerTestCase { + OpenJPAEntityManager em; + EntityF entityF; + + @Override + public void setUp() throws Exception { + + // TODO: Delimiter support is currently limited to database that use + // double quote as a delimiter. + // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase + // is resolved. + setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); + if (isTestsDisabled()) + return; + + super.setUp( + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityF.class, + DROP_TABLES); + assertNotNull(emf); + + em = emf.createEntityManager(); + assertNotNull(em); + } + + public void createEntityF() { + entityF = new EntityF("fName"); + entityF.setNonDelimName("fNonDelimName"); + entityF.setSecName("sec name"); + entityF.addCollectionSet("xxx"); + entityF.addCollectionSet("yyy"); + entityF.addCollectionDelimSet("aaa"); + entityF.addCollectionDelimSet("bbb"); + entityF.addCollectionMap("aaa", "xxx"); + entityF.addCollectionMap("bbb", "yyy"); + entityF.addDelimCollectionMap("www", "xxx"); + entityF.addDelimCollectionMap("yyy", "zzz"); + } + + public void testCreateF() { + createEntityF(); + + em.getTransaction().begin(); + em.persist(entityF); + em.getTransaction().commit(); + + runQueries(); + + } + + // Run a second time to re-create a situation that initially caused a problem when running this + // test consecutive times. + public void testCreateF2() { + createEntityF(); + + em.getTransaction().begin(); + em.persist(entityF); + em.getTransaction().commit(); + } + + private void runQueries() { + em.clear(); + queryOnEntityOnly(); + em.clear(); + queryOnColumnValue(); + em.clear(); + queryCollection(); + } + + private void queryOnEntityOnly() { + String query = + "SELECT DISTINCT f " + + "FROM EntityF f"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + private void queryOnColumnValue() { + String query = + "SELECT DISTINCT f " + + "FROM EntityF f " + + "WHERE f.name = 'fName'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + private void queryCollection() { + String query = + "SELECT DISTINCT f " + + "FROM EntityF f, IN(f.collectionDelimSet) s " + + "WHERE s = 'aaa'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java index baa272e90..99ddae8f9 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java @@ -1,119 +1,119 @@ -/* - * 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.delimited.identifiers.noschema; - -import org.apache.openjpa.jdbc.conf.JDBCConfiguration; -import org.apache.openjpa.jdbc.sql.DB2Dictionary; -import org.apache.openjpa.jdbc.sql.DBDictionary; -import org.apache.openjpa.jdbc.sql.MySQLDictionary; -import org.apache.openjpa.persistence.OpenJPAEntityManager; -import org.apache.openjpa.persistence.test.AllowFailure; -import org.apache.openjpa.persistence.test.SQLListenerTestCase; - -@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + - "order issues are resolved.") -public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase { - OpenJPAEntityManager em; - JDBCConfiguration conf; - DBDictionary dict; - boolean supportsNativeSequence = false; - - EntityE entityE; - - @Override - public void setUp() throws Exception { - - // TODO: Delimiter support is currently limited to database that use - // double quote as a delimiter. - // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase - // is resolved. - setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); - if (isTestsDisabled()) - return; - - super.setUp(EntityE.class, DROP_TABLES); - assertNotNull(emf); - - conf = (JDBCConfiguration) emf.getConfiguration(); - dict = conf.getDBDictionaryInstance(); - supportsNativeSequence = dict.nextSequenceQuery != null; - - if (supportsNativeSequence) { - em = emf.createEntityManager(); - assertNotNull(em); - } - } - - public void createEntityE() { - entityE = new EntityE("e name"); - } - - // TODO: temp -// public void testDBCapability() { -// Connection conn = (Connection)em.getConnection(); -// try { -// DatabaseMetaData meta = conn.getMetaData(); -// System.out.println("LC - " + -// meta.storesLowerCaseIdentifiers()); -// System.out.println("LCQ - " + -// meta.storesLowerCaseQuotedIdentifiers()); -// System.out.println("MC - " + -// meta.storesMixedCaseIdentifiers()); -// System.out.println("MCQ - " + -// meta.storesMixedCaseQuotedIdentifiers()); -// System.out.println("UC - " + -// meta.storesUpperCaseIdentifiers()); -// System.out.println("UCQ - " + -// meta.storesUpperCaseQuotedIdentifiers()); -// -// System.out.println("db product name - " + -// meta.getDatabaseProductName()); -// System.out.println("db product version - " + -// meta.getDatabaseProductVersion()); -// System.out.println("driver name - " + -// meta.getDriverName()); -// System.out.println("driver version - " + -// meta.getDriverVersion()); -// } catch (SQLException e) { -// e.printStackTrace(); -// } -// } - - public void testSeqGen() { - if (!supportsNativeSequence) { - return; - } - createEntityE(); - - em.getTransaction().begin(); - em.persist(entityE); - em.getTransaction().commit(); - - System.out.println(super.toString(sql)); - - int genId = entityE.getId(); - em.clear(); - em.getTransaction().begin(); - EntityE eA = em.find(EntityE.class, genId); - assertEquals("e name", eA.getName()); - - em.getTransaction().commit(); - em.close(); - } -} +/* + * 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.delimited.identifiers.noschema; + +import org.apache.openjpa.jdbc.conf.JDBCConfiguration; +import org.apache.openjpa.jdbc.sql.DB2Dictionary; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.jdbc.sql.MySQLDictionary; +import org.apache.openjpa.persistence.OpenJPAEntityManager; +import org.apache.openjpa.persistence.test.AllowFailure; +import org.apache.openjpa.persistence.test.SQLListenerTestCase; + +@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + + "order issues are resolved.") +public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase { + OpenJPAEntityManager em; + JDBCConfiguration conf; + DBDictionary dict; + boolean supportsNativeSequence = false; + + EntityE entityE; + + @Override + public void setUp() throws Exception { + + // TODO: Delimiter support is currently limited to database that use + // double quote as a delimiter. + // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase + // is resolved. + setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); + if (isTestsDisabled()) + return; + + super.setUp(EntityE.class, DROP_TABLES); + assertNotNull(emf); + + conf = (JDBCConfiguration) emf.getConfiguration(); + dict = conf.getDBDictionaryInstance(); + supportsNativeSequence = dict.nextSequenceQuery != null; + + if (supportsNativeSequence) { + em = emf.createEntityManager(); + assertNotNull(em); + } + } + + public void createEntityE() { + entityE = new EntityE("e name"); + } + + // TODO: temp +// public void testDBCapability() { +// Connection conn = (Connection)em.getConnection(); +// try { +// DatabaseMetaData meta = conn.getMetaData(); +// System.out.println("LC - " + +// meta.storesLowerCaseIdentifiers()); +// System.out.println("LCQ - " + +// meta.storesLowerCaseQuotedIdentifiers()); +// System.out.println("MC - " + +// meta.storesMixedCaseIdentifiers()); +// System.out.println("MCQ - " + +// meta.storesMixedCaseQuotedIdentifiers()); +// System.out.println("UC - " + +// meta.storesUpperCaseIdentifiers()); +// System.out.println("UCQ - " + +// meta.storesUpperCaseQuotedIdentifiers()); +// +// System.out.println("db product name - " + +// meta.getDatabaseProductName()); +// System.out.println("db product version - " + +// meta.getDatabaseProductVersion()); +// System.out.println("driver name - " + +// meta.getDriverName()); +// System.out.println("driver version - " + +// meta.getDriverVersion()); +// } catch (SQLException e) { +// e.printStackTrace(); +// } +// } + + public void testSeqGen() { + if (!supportsNativeSequence) { + return; + } + createEntityE(); + + em.getTransaction().begin(); + em.persist(entityE); + em.getTransaction().commit(); + + System.out.println(super.toString(sql)); + + int genId = entityE.getId(); + em.clear(); + em.getTransaction().begin(); + EntityE eA = em.find(EntityE.class, genId); + assertEquals("e name", eA.getName()); + + em.getTransaction().commit(); + em.close(); + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java index 429db1615..8b75239b8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java @@ -1,169 +1,169 @@ -/* - * 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.delimited.identifiers.noschema; - -import java.util.List; - -import javax.persistence.Query; - -import org.apache.openjpa.jdbc.conf.JDBCConfiguration; -import org.apache.openjpa.jdbc.sql.DB2Dictionary; -import org.apache.openjpa.jdbc.sql.DBDictionary; -import org.apache.openjpa.jdbc.sql.MySQLDictionary; -import org.apache.openjpa.persistence.OpenJPAEntityManager; -import org.apache.openjpa.persistence.test.AllowFailure; -import org.apache.openjpa.persistence.test.SQLListenerTestCase; - -@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + - "order issues are resolved.") -public class TestNoSchemaManualDelimitedJoinAnnotations extends SQLListenerTestCase { - OpenJPAEntityManager em; - int id = 0; - EntityC entityC; - EntityD entityD; - EntityD2 entityD2; - EntityD3 entityD3; - EntityD4 entityD4; - JDBCConfiguration conf; - DBDictionary dict; - - @Override - public void setUp() throws Exception { - - // TODO: Delimiter support is currently limited to database that use - // double quote as a delimiter. - // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase - // is resolved. - setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); - if (isTestsDisabled()) - return; - - super.setUp( - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityC.class, - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD.class, - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD2.class, - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD3.class, - org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD4.class, - DROP_TABLES); - assertNotNull(emf); - - em = emf.createEntityManager(); - assertNotNull(em); - - conf = (JDBCConfiguration) emf.getConfiguration(); - dict = conf.getDBDictionaryInstance(); - } - - private void createCandD(int id) { - entityC = new EntityC(id); - entityC.setName("ec"); - entityC.setSecName("secName1"); - - entityD = new EntityD(id); - entityD.setName("ed"); - - entityD2 = new EntityD2(id); - entityD2.setName("ed2"); - - entityD3 = new EntityD3(id); - entityD3.setName("ed3"); - - entityD4 = new EntityD4(id); - entityD4.setName("ed4"); - - entityC.addEntityD(entityD); - entityD.addEntityC(entityC); - - entityC.setEntityD2(entityD2); - - entityC.addMapValues(entityD3, entityD4); - entityC.addMap2Values(entityD4, entityD3); - - entityD2.setEntityD3(entityD3); - } - - public void testCreate() { - id++; - createCandD(id); - // TODO: Maybe create another one. - - em.getTransaction().begin(); - em.persist(entityC); - em.persist(entityD); - em.persist(entityD2); - em.persist(entityD3); - em.persist(entityD4); - em.getTransaction().commit(); - - runQueries(); - } - - private void runQueries() { - em.clear(); - queryJoinTable(); - em.clear(); - queryJoinColumn(); - em.clear(); - querySecondaryTableValue(); - em.clear(); - queryMapValue(); - } - - private void queryJoinTable() { - String query = - "SELECT c " + - "FROM EntityC c JOIN c.entityDs d " + - "WHERE d.name = 'ed'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - private void queryJoinColumn() { - String query = - "SELECT c " + - "FROM EntityC c JOIN c.entityD2 d2 " + - "WHERE d2.name = 'ed2'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - private void querySecondaryTableValue() { - String query = - "SELECT c " + - "FROM EntityC c " + - "WHERE c.secName = 'secName1'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - private void queryMapValue() { - String query = - "SELECT c " + - "FROM EntityC c, IN(c.map2) m " + - "WHERE m.name = 'ed3'"; - Query q = em.createQuery(query); - List results = (List)q.getResultList(); - assertEquals(1,results.size()); - } - - -} +/* + * 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.delimited.identifiers.noschema; + +import java.util.List; + +import javax.persistence.Query; + +import org.apache.openjpa.jdbc.conf.JDBCConfiguration; +import org.apache.openjpa.jdbc.sql.DB2Dictionary; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.jdbc.sql.MySQLDictionary; +import org.apache.openjpa.persistence.OpenJPAEntityManager; +import org.apache.openjpa.persistence.test.AllowFailure; +import org.apache.openjpa.persistence.test.SQLListenerTestCase; + +@AllowFailure(message="Temporarily allowing this test to fail until cleanup " + + "order issues are resolved.") +public class TestNoSchemaManualDelimitedJoinAnnotations extends SQLListenerTestCase { + OpenJPAEntityManager em; + int id = 0; + EntityC entityC; + EntityD entityD; + EntityD2 entityD2; + EntityD3 entityD3; + EntityD4 entityD4; + JDBCConfiguration conf; + DBDictionary dict; + + @Override + public void setUp() throws Exception { + + // TODO: Delimiter support is currently limited to database that use + // double quote as a delimiter. + // Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase + // is resolved. + setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class); + if (isTestsDisabled()) + return; + + super.setUp( + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityC.class, + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD.class, + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD2.class, + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD3.class, + org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD4.class, + DROP_TABLES); + assertNotNull(emf); + + em = emf.createEntityManager(); + assertNotNull(em); + + conf = (JDBCConfiguration) emf.getConfiguration(); + dict = conf.getDBDictionaryInstance(); + } + + private void createCandD(int id) { + entityC = new EntityC(id); + entityC.setName("ec"); + entityC.setSecName("secName1"); + + entityD = new EntityD(id); + entityD.setName("ed"); + + entityD2 = new EntityD2(id); + entityD2.setName("ed2"); + + entityD3 = new EntityD3(id); + entityD3.setName("ed3"); + + entityD4 = new EntityD4(id); + entityD4.setName("ed4"); + + entityC.addEntityD(entityD); + entityD.addEntityC(entityC); + + entityC.setEntityD2(entityD2); + + entityC.addMapValues(entityD3, entityD4); + entityC.addMap2Values(entityD4, entityD3); + + entityD2.setEntityD3(entityD3); + } + + public void testCreate() { + id++; + createCandD(id); + // TODO: Maybe create another one. + + em.getTransaction().begin(); + em.persist(entityC); + em.persist(entityD); + em.persist(entityD2); + em.persist(entityD3); + em.persist(entityD4); + em.getTransaction().commit(); + + runQueries(); + } + + private void runQueries() { + em.clear(); + queryJoinTable(); + em.clear(); + queryJoinColumn(); + em.clear(); + querySecondaryTableValue(); + em.clear(); + queryMapValue(); + } + + private void queryJoinTable() { + String query = + "SELECT c " + + "FROM EntityC c JOIN c.entityDs d " + + "WHERE d.name = 'ed'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + private void queryJoinColumn() { + String query = + "SELECT c " + + "FROM EntityC c JOIN c.entityD2 d2 " + + "WHERE d2.name = 'ed2'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + private void querySecondaryTableValue() { + String query = + "SELECT c " + + "FROM EntityC c " + + "WHERE c.secName = 'secName1'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + private void queryMapValue() { + String query = + "SELECT c " + + "FROM EntityC c, IN(c.map2) m " + + "WHERE m.name = 'ed3'"; + Query q = em.createQuery(query); + List results = (List)q.getResultList(); + assertEquals(1,results.size()); + } + + +}