[Hibernate-JIRA] Created: (ANN-632) @IndexColumn doesn't set value of index column
by Dan Allen (JIRA)
@IndexColumn doesn't set value of index column
----------------------------------------------
Key: ANN-632
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-632
Project: Hibernate Annotations
Issue Type: Bug
Components: documentation
Affects Versions: 3.3.0.ga
Reporter: Dan Allen
I'm sure I will get screamed at for this, but the @IndexColumn just doesn't work with @OneToMany. When I say it doesn't work, it means that I am a reasonable person and I have studied the documentation for at least 4 hours and I just cannot figure out how to make it work. So either the documentation needs to be improved, or there is something wrong with Hibernate. I refuse to believe that I am this stupid.
Here is my problem in a nutshell. I have a Person and a collection of Jobs. The Jobs should be an indexed list based on the history that the person holds them.
@Entity
public class Person {
@Id @GeneratedValue
private long id;
@Column
private String name;
@OneToMany(cascade=ALL, fetch=LAZY, mappedBy = "job")
@IndexColumn(base = 1, name = "order")
private List<Job> jobs = new ArrayList<Job>();
// getters and setters
}
@Entity
public class Job {
@Id @GeneratedValue
private long id;
@Column
private String name;
@ManyToOne
@JoinColumn(name="person_id")
private Person person;
@Column
private Integer order;
// getters and setters
}
If I do the following, I get NULL for order.
Person person = new Person();
person.setName("Chuck")
Job job1 = new Job();
job1.setName("sysadmin")
job1.setPerson(person);
person.getJobs().add(job1);
Job job2 = new Job();
jobs2.setName("network admin")
job2.setPerson(person);
person.getJobs().add(job2);
entityManager.persist(person);
Assume that the reason I am not assigning an order is more complex than this example. The point is that we want to see the order column populated with the index of the list.
Now, if you give me the business about removing mappedBy, to that I will respond that by removing mappedBy, Hibernate tries to work with a person_job table, which I don't want. I want two tables, one for person and one for job.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-3730) ManyToOneType.isModified
by Riccardo Mirasola (JIRA)
ManyToOneType.isModified
-------------------------
Key: HHH-3730
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3730
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1
Reporter: Riccardo Mirasola
Priority: Minor
public class ManyToOneType extends EntityType {
.....
public boolean isModified(
Object old,
Object current,
boolean[] checkable,
SessionImplementor session) throws HibernateException {
if ( current == null ) {
return old!=null;
}
if ( old == null ) {
// we already know current is not null...
return true;
}
// the ids are fully resolved, so compare them with isDirty(), not isModified()
return getIdentifierOrUniqueKeyType( session.getFactory() )
.isDirty( old, getIdentifier( current, session ), session );
}
....
}
When using findModified method on the EntityPersister all no null many-to-one properties is returned as modified because the isDirty is called with old that is the object instance (ie. not the identifier) and for current the identifier is resolved. Last line should be
return getIdentifierOrUniqueKeyType( session.getFactory() )
.isDirty( getIdentifier( old, session ), getIdentifier( current, session ), session );
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2622) CLONE -Fields quetes must be applied in queries to prevent mix reserved words with fields names
by Igor A Tarasov (JIRA)
CLONE -Fields quetes must be applied in queries to prevent mix reserved words with fields names
-----------------------------------------------------------------------------------------------
Key: HHH-2622
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2622
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.0 cr1
Environment: MySQL 4.1.16 Hibernate 3.2 cr1 Fedora Core 4
Reporter: Igor A Tarasov
Quotes must be appied to fields in queries.
The environment log is:
org.hibernate.cfg.Environment Hibernate 3.2 cr1
org.hibernate.cfg.SettingsFactory RDBMS: MySQL, version: 4.1.16
org.hibernate.cfg.SettingsFactory JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12
org.hibernate.dialect.Dialect Using dialect: org.hibernate.dialect.MySQLDialect
I have an entity, named Group:
@Entity
public class Group {
..
}
But, 'GROUP' is the reserved word of MySQL query language.
Log of hibernate show, that queries is without quotes:
org.hibernate.persister.entity.AbstractEntityPersister Static SQL for entity: org.dicr.isp.entity.Group
org.hibernate.persister.entity.AbstractEntityPersister Version select: select id from Group where id =?
org.hibernate.persister.entity.AbstractEntityPersister Snapshot select: select group_.id, group_.name as name0_, group_.comment as comment0_ from Group group_ where group_.id=?
org.hibernate.persister.entity.AbstractEntityPersister Insert 0: insert into Group (name, comment, id) values (?, ?, ?)
org.hibernate.persister.entity.AbstractEntityPersister Update 0: update Group set name=?, comment=? where id=?
org.hibernate.persister.entity.AbstractEntityPersister Delete 0: delete from Group where id=?
org.hibernate.persister.entity.AbstractEntityPersister Identity insert: insert into Group (name, comment) values (?, ?)
And this make a critical error in program logic:
org.hibernate.tool.hbm2ddl.DatabaseMetadata table not found: Group
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate Unsuccessful: create table Group (id bigint not null auto_increment, name varchar(255) not null unique, comment varchar(255), primary key (id))
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Group (id bigint not null auto_increment, name varchar(255) not null unique, com' at line 1
[2006-04-27 23:57:23,895] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate schema update complete
The query: "create table Group (id bigint ..." is not correct.
Must be: "create table `Group` (`id` bigint ..."
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-468) MysqlDialect incorrectly maps java.lang.Boolean to SQL BIT
by Kaoru Shirai (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-468?page=co... ]
Kaoru Shirai commented on HHH-468:
----------------------------------
> Can't we just map BIT to tinyint(1) in the MySQL dialect. This seems okay for all MySQL dialects (MyISAM and InnoDB).
> One of the problems with bit in MySQL is that standard it's not show in a MySQL console.
Me, too! I think this change does not affect seriously.
This problem is annoying many people:
[mysql bit hibernate boolean - Google Search]
http://www.google.com/search?q=mysql+bit+hibernate+boolean
> MysqlDialect incorrectly maps java.lang.Boolean to SQL BIT
> ----------------------------------------------------------
>
> Key: HHH-468
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-468
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.3
> Environment: Hibernate 3.0, MySQL.
> Reporter: Mark Matthews
> Assignee: Scott Marlow
>
> I didn't track down how java.lang.Boolean gets mapped to Types.BIT in hibernate, but you probably _don't_ want to map to "bit" like you do in MysqlDialect.
> "bit", according to SQL99 (it's not in the core standard, and the type was actually dropped for sql2k3) is a bitfield, not a boolean value. You can of course define a bit(1), but it is technically more correct for java.lang.Boolean to map to a SQL BOOLEAN for MySQL since we support a BOOLEAN and a BIT.
> It looks like the JDBC-3.0 guys ignored what the standard said, because in reality you'd want BIT to map to something like byte[], or java.util.BitSet if you were tracking how the SQL standard defines BIT.
> I'm guessing you probably want to map to "boolean", which the JDBC driver will automagically convert for you, as it silently maps to TINYINT(1) on the server side.
--
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, 11 months
[Hibernate-JIRA] Created: (HSEARCH-233) Only one @IndexedEmbedded collection working in my entity.
by sam doyle (JIRA)
Only one @IndexedEmbedded collection working in my entity.
----------------------------------------------------------
Key: HSEARCH-233
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-233
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.0.1.GA
Environment: JBoss AS 4.2.2 Windows
Reporter: sam doyle
Attachments: jiraFiles.tar.gz
This is supposedly pretty basic functionality so perhaps it is my particular case that it is causing it.
In the attachment files the EmtVenue class is the root of the indexing.
It contains two @IndexedEmbedded
@OneToMany( cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "emtVenue" )
@IndexedEmbedded
public Set<ClientGroupVenue> getClientGroupVenues()
@Embedded
@ManyToOne( fetch = FetchType.LAZY )
@JoinColumns( { @JoinColumn( nullable = false, name = "HOST", referencedColumnName = "HOST" ),
@JoinColumn( nullable = false, name = "zone", referencedColumnName = "ZONE" ) } )
@NotNull
@IndexedEmbedded
public Zones getZones()
In this case when I index EmtVenue the resulting index contains only values that correspond to Zones and no ClientGroupVenues.
When I comment out the @IndexedEmbedded on the Zones the resulting index does show the categories.
One side note that might be of interest is indexing of Zones results in referencing some entities which don't exist that I'm catching due to the data not being in sync.
--
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, 11 months