[Hibernate-JIRA] Created: (ANN-824) Annotations - MSSQL, DB2, Sybase - Nullable Foreign PK not allowed
by Gail Badner (JIRA)
Annotations - MSSQL, DB2, Sybase - Nullable Foreign PK not allowed
------------------------------------------------------------------
Key: ANN-824
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-824
Project: Hibernate Annotations
Issue Type: Bug
Environment: MSSQL, DB2, Sybase
Reporter: Gail Badner
Assignee: Emmanuel Bernard
Fix For: 3.5
MSSQL, DB2, and Sybase require primary key columns to be non-nullable. Some unit tests are failing using those DBs because a primary keys are defined with one or more nullable columns. This is happening with both trunk and v3_3_1_GA_CP.
I see other JIRA issues that sound related that are marked as fixed, so I'm surprised to see these failing in trunk.
HHH-1935 sounds related. It mentions a bug in SchemaUpdate using @MapKey with @CollectionOfElements.
Workarounds are:
- add "nullable=false" to @JoinColumn
- add "optional=false" to @ManyToOne
- add an @AttributeOverride with @Column(name="mapkey", nullable=false) in case of a @CollectionOfElements using a Map
- add "nullable=false" in @Column when inside a @CollectionId or inside @MapKey
I've included the table DDL causing the failure. Also, there were some tests I couldn't get to pass using a workaround.
org.hibernate.test.annotations.any.AnyTest
create table map_properties ( map_id int not null, property_type varchar(255) null,
property_id int not null, map_key varchar(255) null, primary key (map_id, map_key) )
org.hibernate.test.annotations.cid.CompositeIdTest
create table A ( bid numeric(19,0) null, cid numeric(19,0) null, primary key (bid, cid) )
create table Child ( nth int not null, parentFirstName varchar(255) null, parentLastName varchar(255) null,
primary key (nth, parentFirstName, parentLastName) )
create table TvMagazin ( time datetime null, chan_id int null, presenter_name varchar(255) null,
primary key (chan_id, presenter_name) )
create table TvProgram ( time datetime null, channel_id int null, presenter_name varchar(255) null,
primary key (channel_id, presenter_name) )
create table TvProgramIdClass ( time datetime null, channel_id int null, presenter_name varchar(255) null,
primary key (channel_id, presenter_name) )
org.hibernate.test.annotations.collectionelement.CollectionElementTest
create table Matrix_values ( Matrix_id int not null, element float null, mapkey int null,
primary key (Matrix_id, mapkey) )
create table ScorePerNickName ( BoyId int not null, fld_score int null, mapkey varchar(255) null,
primary key (BoyId, mapkey) )
create table TestCourse_variations ( TestCourse_testCourseId numeric(19,0) not null,
element varchar(255) null, language_code varchar(255) null,
primary key (TestCourse_testCourseId, language_code) )
org.hibernate.test.annotations.collectionelement.indexedCollection.IndexedCollectionOfElementsTest.testIndexedCollectionOfElements
create table contact ( n_key_person int not null, name varchar(255) null, n_key_contact numeric(19,0) null,
primary key (n_key_contact) )
org.hibernate.test.annotations.identifiercollection.IdentifierCollectionTest.testIdBag
NOTE: I could not find a workaround to fix this test.
create table PASSPORT_STAMP ( Passport_passport_id numeric(19,0) not null,
stamps_id numeric(19,0) not null, COLLECTION_ID numeric(19,0) null,
primary key (COLLECTION_ID) )
create table PASSPORT_VISASTAMP ( Passport_passport_id numeric(19,0) not null,
visaStamp_id numeric(19,0) not null, COLLECTION_ID numeric(19,0) null,
primary key (COLLECTION_ID) )
org.hibernate.test.annotations.indexcoll.IndexedCollectionTest
create table Atmosphere_Gas ( Atmosphere_id int not null, gases_id int not null,
gas_name varchar(255) null, primary key (Atmosphere_id, gas_name) )
org.hibernate.test.annotations.target.TargetTest
NOTE: I could not find a workaround to fix this test.
create table Brand_LuggageImpl ( Brand_id numeric(19,0) not null,
luggagesBySize_id numeric(19,0) not null, name varchar(255) null,
primary key (Brand_id, name) )
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months
[Hibernate-JIRA] Created: (HV-164) Add test for default group sequence isolation
by Emmanuel Bernard (JIRA)
Add test for default group sequence isolation
---------------------------------------------
Key: HV-164
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-164
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.0.0.Beta1
Reporter: Emmanuel Bernard
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Beta2
public interface Minimal {}
public interface Heavy {}
## test 1 - Rule D
@GroupSequence( {Minimal.class, A.class} )
public class A {
@Max(value = 10, groups = Minimal.class) int size;
@Size(max=50) String name; //A group
}
@GroupSequence( {B.class, Heavy.class} )
public class B extends A {
@SafeEncryption(groups = Heavy.class) String encryptionKey;
@Size(max=50) String nickname; //B group
}
when validating Default.class on B, you need to validate sequentially:
- @Size on name and @Size on nickname (A is part of B)
- @SafeEncryption on encryptionKey
note that @Max on size is not validated as it's not part of the sequence nor the group A
## test 2 - Rule D
@GroupSequence( {Minimal.class, A.class} )
public class A {
@Max(value = 10, groups = Minimal.class) int size;
@Size(max=50) String name; //A group
}
@GroupSequence( {Minimal.class, B.class, Heavy.class} )
public class B extends A {
@SafeEncryption(groups = Heavy.class) String encryptionKey;
@Size(max=50) String nickname; //B group
}
when validating Default.class on B, you need to validate sequentially:
- @Max on size (Minnimal group)
- @Size on name and @Size on nickname (A is part of B)
- @SafeEncryption on encryptionKey
## test 3 Rules C1 and C2
@GroupSequence( {Minimal.class, A.class} )
public class A {
@Max(value = 10, groups = Minimal.class) int size;
@Size(max=50) String name; //A group
}
public class B extends A {
@SafeEncryption(groups = Heavy.class) String encryptionKey;
@Size(max=50) String nickname; //B group
}
when validating Default.class on B, you need to validate sequentially:
- @Max on size (Minimal)
- @Size on name (A)
and in // at any time @Size on nickname (B group). Note that B is not constrained by the group sequence defined by A, B contains A. @Size on nickname could fail but @Size on name will be validated. Likewise @Max on size could fail and @Size on nickname (A) will be validated (note that @Size on nickname (B) will not as it has to be validated only if Minimal constraints pass)
All based on http://people.redhat.com/~ebernard/validation/#constraintdeclarationvalid...
particularly
C1, C2 and D
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months
Hibernate search with manytoone association IndexedEmbedded doesnt work
by Halil Ağın
Hello List;
I am trying to implement hibernate search with IndexedEmbedded on my pojos
which are associated with manytoone.
I have two pojo: Diary.java and User.java. the related code segments are
listed below:
=================Diary.java=======================
@Entity(name="tr.com.yazmanak.portal.dal.yazmanak.diary.Diary")
@Table(name="yazmanak_diary")
@Indexed
public class Diary extends BasePojo{
@ManyToOne
@JoinColumn(name="user_fk")
@IndexedEmbedded
private User user;
/* other columns and getter/setter functions omitted*/
}
=================User.java=======================
*/
@Entity(name="tr.com.yazmanak.portal.dal.user.User")
@Table(name="yazmanak_user")
@Indexed
public class User extends BasePojo {
@Column(name="name")
@Field(name="name",index=Index.TOKENIZED,store=Store.NO)
@FieldBridge(impl=StringBridge.class)
private String name;
@OneToMany(mappedBy="user",fetch=FetchType.LAZY,targetEntity=Diary.class)
@ContainedIn
private Set<Diary> diaries;
}
I want to search user name while searching on Diary class. My search test
class is below:
==================SearchTest.java===================
public class SearchTest{
public static List searchByKeyword2(FullTextSession fs) throws
org.apache.lucene.queryParser.ParseException {
org.apache.lucene.queryParser.QueryParser parser =
new QueryParser("id", new StandardAnalyzer() );
org.apache.lucene.search.Query luceneQuery = parser.parse(
"user.name:halil And content:veli");
org.hibernate.Query fullTextQuery = fs.createFullTextQuery(
luceneQuery,Diary.class );
List result = fullTextQuery.list(); //return a list of managed
objects
return result;
}
}
=====================end of codes========================
I want to do search with user.name whike querying onn Diary pojo. But i
couldnt. I search the net for 2 days. Some people encounter the same problem
and some solves also.
but i couldnt what is the problem? any help? By the way, i can search on
other columns but i couldnt search on associated columns such as manytone.
for example, above one.
thank you very much,
regards,
-Halil AĞIN
15 years, 6 months