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
This commit is contained in:
Michael Dick 2009-09-28 14:36:49 +00:00
parent 174f2af0de
commit 562b4942df
11 changed files with 1257 additions and 1257 deletions

View File

@ -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<EntityD> entityDs = new HashSet<EntityD>();
@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<EntityD3,EntityD4> map = new HashMap<EntityD3,EntityD4>();
@ManyToMany
@JoinTable(name="\"map2 join table\"")
@MapKeyJoinColumn(name="\"map ed4\"",
referencedColumnName="\"entityD4 id\"")
Map<EntityD4,EntityD3> map2 = new HashMap<EntityD4,EntityD3>();
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<EntityD> getEntityDs() {
return entityDs;
}
/**
* @param entityDs the entityDs to set
*/
public void setEntityDs(Collection<EntityD> 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<EntityD3, EntityD4> getMap() {
return map;
}
/**
* @param map the map to set
*/
public void setMap(Map<EntityD3, EntityD4> map) {
this.map = map;
}
public void addMapValues(EntityD3 key, EntityD4 value) {
map.put(key, value);
}
/**
* @return the map2
*/
public Map<EntityD4, EntityD3> getMap2() {
return map2;
}
/**
* @param map2 the map2 to set
*/
public void setMap2(Map<EntityD4, EntityD3> 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<EntityD> entityDs = new HashSet<EntityD>();
@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<EntityD3,EntityD4> map = new HashMap<EntityD3,EntityD4>();
@ManyToMany
@JoinTable(name="\"map2 join table\"")
@MapKeyJoinColumn(name="\"map ed4\"",
referencedColumnName="\"entityD4 id\"")
Map<EntityD4,EntityD3> map2 = new HashMap<EntityD4,EntityD3>();
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<EntityD> getEntityDs() {
return entityDs;
}
/**
* @param entityDs the entityDs to set
*/
public void setEntityDs(Collection<EntityD> 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<EntityD3, EntityD4> getMap() {
return map;
}
/**
* @param map the map to set
*/
public void setMap(Map<EntityD3, EntityD4> map) {
this.map = map;
}
public void addMapValues(EntityD3 key, EntityD4 value) {
map.put(key, value);
}
/**
* @return the map2
*/
public Map<EntityD4, EntityD3> getMap2() {
return map2;
}
/**
* @param map2 the map2 to set
*/
public void setMap2(Map<EntityD4, EntityD3> 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;
}
}

View File

@ -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<EntityC> entityCs = new HashSet<EntityC>();
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<EntityC> getEntityCs() {
return entityCs;
}
/**
* @param entityCs the entityCs to set
*/
public void setEntityCs(Collection<EntityC> 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<EntityC> entityCs = new HashSet<EntityC>();
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<EntityC> getEntityCs() {
return entityCs;
}
/**
* @param entityCs the entityCs to set
*/
public void setEntityCs(Collection<EntityC> entityCs) {
this.entityCs = entityCs;
}
public void addEntityC(EntityC entityC) {
entityCs.add(entityC);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<String> collectionSet = new HashSet<String>();
@ElementCollection
@CollectionTable(name="\"collectionDelimSet\"")
private Set<String> collectionDelimSet = new HashSet<String>();
@ElementCollection
// MapKeyColumn with default name generation
@MapKeyColumn
private Map<String, String> collectionMap = new HashMap<String, String>();
@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<String, String> delimCollectionMap =
new HashMap<String, String>();
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<String> getCollectionSet() {
return collectionSet;
}
/**
* @param collectionSet the collectionSet to set
*/
public void setCollectionSet(Set<String> collectionSet) {
this.collectionSet = collectionSet;
}
public void addCollectionSet(String item) {
collectionSet.add(item);
}
/**
* @return the collectionNamedSet
*/
public Set<String> getCollectionDelimSet() {
return collectionDelimSet;
}
/**
* @param collectionNamedSet the collectionNamedSet to set
*/
public void setCollectionDelimSet(Set<String> collectionDelimSet) {
this.collectionDelimSet = collectionDelimSet;
}
public void addCollectionDelimSet(String item) {
this.collectionDelimSet.add(item);
}
/**
* @return the collectionMap
*/
public Map<String, String> getCollectionMap() {
return collectionMap;
}
/**
* @param collectionMap the collectionMap to set
*/
public void setCollectionMap(Map<String, String> collectionMap) {
this.collectionMap = collectionMap;
}
public void addCollectionMap(String key, String value) {
collectionMap.put(key, value);
}
/**
* @return the delimCollectionMap
*/
public Map<String, String> getDelimCollectionMap() {
return delimCollectionMap;
}
/**
* @param delimCollectionMap the delimCollectionMap to set
*/
public void setDelimCollectionMap(Map<String, String> 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<String> collectionSet = new HashSet<String>();
@ElementCollection
@CollectionTable(name="\"collectionDelimSet\"")
private Set<String> collectionDelimSet = new HashSet<String>();
@ElementCollection
// MapKeyColumn with default name generation
@MapKeyColumn
private Map<String, String> collectionMap = new HashMap<String, String>();
@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<String, String> delimCollectionMap =
new HashMap<String, String>();
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<String> getCollectionSet() {
return collectionSet;
}
/**
* @param collectionSet the collectionSet to set
*/
public void setCollectionSet(Set<String> collectionSet) {
this.collectionSet = collectionSet;
}
public void addCollectionSet(String item) {
collectionSet.add(item);
}
/**
* @return the collectionNamedSet
*/
public Set<String> getCollectionDelimSet() {
return collectionDelimSet;
}
/**
* @param collectionNamedSet the collectionNamedSet to set
*/
public void setCollectionDelimSet(Set<String> collectionDelimSet) {
this.collectionDelimSet = collectionDelimSet;
}
public void addCollectionDelimSet(String item) {
this.collectionDelimSet.add(item);
}
/**
* @return the collectionMap
*/
public Map<String, String> getCollectionMap() {
return collectionMap;
}
/**
* @param collectionMap the collectionMap to set
*/
public void setCollectionMap(Map<String, String> collectionMap) {
this.collectionMap = collectionMap;
}
public void addCollectionMap(String key, String value) {
collectionMap.put(key, value);
}
/**
* @return the delimCollectionMap
*/
public Map<String, String> getDelimCollectionMap() {
return delimCollectionMap;
}
/**
* @param delimCollectionMap the delimCollectionMap to set
*/
public void setDelimCollectionMap(Map<String, String> delimCollectionMap) {
this.delimCollectionMap = delimCollectionMap;
}
public void addDelimCollectionMap(String key, String value) {
delimCollectionMap.put(key, value);
}
}

View File

@ -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;
}
}

View File

@ -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<EntityF> results = (List<EntityF>)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<EntityF> results = (List<EntityF>)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<EntityF> results = (List<EntityF>)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<EntityF> results = (List<EntityF>)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<EntityF> results = (List<EntityF>)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<EntityF> results = (List<EntityF>)q.getResultList();
assertEquals(1,results.size());
}
}

View File

@ -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();
}
}

View File

@ -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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)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<EntityC> results = (List<EntityC>)q.getResultList();
assertEquals(1,results.size());
}
}