Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: org.eclipse.jpt.db.Column and its implementation class DTPColumnWrapper wrap DTP org.eclipse.datatools.modelbase.sql.tables.Column. But did not expose all the methods exposed by DTP Column. We’d like to request enhancement to the interface/class to provide following methods: /** * Return whether the column is part of it's table's unique constraint. */ public boolean isPartOfUniqueConstraint(); /** * Return whether the column is nullable. */ public boolean isNullable(); /** * Return whether the column is of numeric type. */ public boolean isNumeric() ; /** * Return precision of the column if it is NumericalDataType * otherwise, return -1 */ public int getPrecision(); /** * Return scale of the column if it is ExactNumericDataType * otherwise, return -1 */ public int getScale(); /** * Return size of the column: * - if the column is CharacterStringDataType, return the length * - otherwise, return -1 */ public int getLength() ; These methods are necessary to generate appropriate JPA Entity annotations, e.g. @Column(name="", nullable=false, precision=4) More information:
Created attachment 113051 [details] Proposed patch
This seems reasonable, my only request is that you also look at adding to our unit tests. These can be found in org.eclipse.jpt.db.tests.internal.platforms
Sure, can you point me to the CVS path of the unit tests? I did not find one named org.eclipse.jpt.db.tests.
The plugin is in org.eclipse.jpa/components/jpa/tests/org.eclipse.jpt.db.tests. I'm not sure why they don't show up directly under the HEAD node, like most of the other plugins
I applied Danny's patch, with a few modifications and additions. It was released and is now part of M2. I also added some JUnit tests; these are in HEAD and will be part of the forthcoming Dali 2.1 branch. To make the things more consistent, I changed some of the existing API in Column: dataTypeIsLOB() -> isLOB() isForeignKeyColumn() -> isPartOfForeignKey() isPrimaryKeyColumn() -> isPartOfPrimaryKey()
Checked M2 and the APIs are added as expected. Thanks! I have another new requirement for the Column class: Column.isAutoIncrement() which should return if the column is using a auto incremented ID sequence. This one is not as straight forward as the ons above. I will create a new bug.