Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 778 invoked from network); 4 Oct 2009 15:04:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Oct 2009 15:04:41 -0000 Received: (qmail 66111 invoked by uid 500); 4 Oct 2009 15:04:40 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 66069 invoked by uid 500); 4 Oct 2009 15:04:40 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 66057 invoked by uid 99); 4 Oct 2009 15:04:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Oct 2009 15:04:40 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mtylenda@o2.pl designates 193.17.41.11 as permitted sender) Received: from [193.17.41.11] (HELO mailout1.go2.pl) (193.17.41.11) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Oct 2009 15:04:30 +0000 Received: from mailout1.go2.pl (unknown [10.0.0.105]) by mailout1.go2.pl (Postfix) with ESMTP id 7285E5F0010 for ; Sun, 4 Oct 2009 17:04:07 +0200 (CEST) Received: from o2.pl (unknown [10.0.0.67]) by mailout1.go2.pl (Postfix) with SMTP for ; Sun, 4 Oct 2009 17:04:07 +0200 (CEST) Subject: =?UTF-8?Q?Re:_Reverse_Mapping_by_MappingTool_does'n_delete_unnecessary?= =?UTF-8?Q?_columns?= From: =?UTF-8?Q?Mi=C5=82osz_Tylenda?= To: dev@openjpa.apache.org In-Reply-To: <1254391948499-3748079.post@n2.nabble.com> References: <1254391948499-3748079.post@n2.nabble.com> Mime-Version: 1.0 Message-ID: <76fd4b6b.2ff6e215.4ac8b966.4fb6e@o2.pl> Date: Sun, 04 Oct 2009 17:04:06 +0200 X-Originator: 79.186.151.157 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, I=20agree=20with=20your=20description=20-=20columns=20should=20be=20dropp= ed.=20Looks=20like=20a=20bug=20or=20unimplemented=20feature.=20Don't=20yo= u=20mind=20creating=20a=20JIRA=20[1]=20issue? [1]=20http://issues.apache.org/jira/browse/OPENJPA Greetings, Milosz >=20 >=20Steps=20to=20reproduce: >=201.=20Create=20the=20class: >=20@Entity >=20@Table(catalog=20=3D=20"testmysql",=20name=20=3D=20"city") >=20public=20class=20CityEntity=20{ >=20=09public=20CityEntity()=20{ >=20=09} >=20 >=20=09private=20String=20m=5Fcityname; >=20 >=20=09@Basic >=20=09@Column(name=20=3D=20"CityName",=20length=20=3D=2015) >=20=09public=20String=20getCityname()=20{ >=20=09=09return=20m=5Fcityname; >=20=09} >=20 >=20=09public=20void=20setCityname(String=20cityname)=20{ >=20=09=09m=5Fcityname=20=3D=20cityname; >=20=09} >=20 >=20=09private=20long=20m=5FId; >=20 >=20=09@Id >=20=09@GeneratedValue(strategy=20=3D=20GenerationType.AUTO) >=20=09public=20long=20getId()=20{ >=20=09=09return=20m=5FId; >=20=09} >=20 >=20=09public=20void=20setId(long=20id)=20{ >=20=09=09m=5FId=20=3D=20id; >=20=09} >=20} >=20 >=202.=20Create=20the=20persistance.xml: >=20 >=20 >=20=20=20=20=20 >=20=20=20=20=20=20=20=20 >=20org.apache.openjpa.persistence.PersistenceProviderImpl >=20=20=20=20=20=20=20=20=20testmysql.server.entity.CityEntity >=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20=20=20=20=20=20=20=20=20=20value=3D"refresh(primaryKeys=3Dtrue,=20ForeignKeys=3Dtrue)"/> >=20=20=20=20=20=20=20=20=20=20=20=20=20=20value=3D"jdbc:mysql://localhost:33306/testmysql2"/> >=20=20=20=20=20=20=20=20=20=20=20=20=20=20value=3D"com.mysql.jdbc.Driver"/> >=20=20=20=20=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20=20=20=20=20=20=20=20=20=20Tool=3DINFO"/> >=20=20=20=20=20=20=20=20=20 >=20=20=20=20=20 >=20 >=203.=20Create=20the=20test=20method: >=20=09private=20String=20JPATest()=20{ >=20=09=09EntityManagerFactory=20factory=20=3D=20null; >=20=09=09EntityManager=20manager=20=3D=20null; >=20=09=09try=20{ >=20=09=09=09factory=20=3D=20Persistence.createEntityManagerFactory("NewP= eristenceUnit"); >=20=09=09=09manager=20=3D=20factory.createEntityManager(); >=20 >=20=09=09=09CityEntity=20city=20=3D=20new=20CityEntity(); >=20 >=20=09=09=09manager.getTransaction().begin(); >=20=09=09=09manager.persist(city); >=20=09=09=09manager.getTransaction().commit(); >=20=09=09} >=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20catch{...} >=20 >=204.=20Run=20the=20test.=20In=20specified=20table=20in=20database=20are= =20now=202=20columns=20id=20and >=20CityName. >=205.=20Now=20delete=20all=20strings=20in=20CityEntity.java=20so,=20that= =20entity=20CityEntity >=20hasn't=20field=20CityName=20more: >=20@Entity >=20@Table(catalog=20=3D=20"testmysql",=20name=20=3D=20"city") >=20public=20class=20CityEntity=20{ >=20=09public=20CityEntity()=20{ >=20=09} >=20 >=20=09private=20long=20m=5FId; >=20 >=20=09@Id >=20=09@GeneratedValue(strategy=20=3D=20GenerationType.AUTO) >=20=09public=20long=20getId()=20{ >=20=09=09return=20m=5FId; >=20=09} >=20 >=20=09public=20void=20setId(long=20id)=20{ >=20=09=09m=5FId=20=3D=20id; >=20=09} >=20} >=20 >=206.=20Run=20test=20again. >=207.=20Column=20CityName=20is=20still=20present=20in=20database=20table= .=20But=20documentation=20for >=20MappingTool=20about=20refresh=20schemaAction=20says: >=20"refresh:=20Equivalent=20to=20retain,=20then=20add. >=20retain:=20Keep=20all=20schema=20components=20in=20the=20given=20XML=20= definition,=20but=20drop=20the >=20rest=20from=20the=20database.=20This=20action=20never=20adds=20any=20= schema=20components.=20" >=20Unnecessary=20columns=20should=20be=20deleted=20in=20database=20since= =20the=20entity=20doesn't >=20contain=20mapped=20fields=20for=20them,=20when=20schemaAction=20is=20= refresh. >=20--=20 >=20View=20this=20message=20in=20context:=20http://n2.nabble.com/Reverse-= Mapping-by-MappingTool-does-n-delete-unnecessary-columns-tp3748079p374807= 9.html >=20Sent=20from=20the=20OpenJPA=20Developers=20mailing=20list=20archive=20= at=20Nabble.com. >=20