Polymorphic 1 « Map « JPA Q&A





1. Java JPA Polymorphic mapping on Many to One    stackoverflow.com

I am trying to map a JPA (using Hibernate now) Many-to-one relationship with a polymorphic type, but I am having no luck. I don't see why it isn't possible, or ...

2. Hibernate polymorphic query    stackoverflow.com

I have two classes, Person and Company, derived from another class Contact. They are represented as polymorphically in two tables (Person and Company). The simplified classes look like this:

public ...

3. How do I express a polymorphic association in JPA?    stackoverflow.com

A polymorphic association is similar to a foreign key or many-to-one relationship, with the difference being that the target might be one of a number of types (classes in ...

4. NHibernate Polymorphic Query on a Collection    stackoverflow.com

I'm trying to write a query in NHibernate. I don't really care if I use the Criteria API or HQL, I just can't figure out how to write the query. Here's my ...

5. How to perform a non-polymorphic HQL query in Hibernate?    stackoverflow.com

I'm using Hibernate 3.1.1, and in particular, I'm using HQL queries. According to the documentation, Hibernate's queries are polymorphic:

A query like: from Cat as cat returns instances not ...

6. How does Jpa Query.setParameter work with MetaValue (polymorphic query)?    stackoverflow.com

I've been trying to use polymorphic query with JPA (hibernate as provider) in the following domain scenario: PriceTable (1) <--->(n) ItemPrice (n) <----> (1) Item So for each PriceTable registered in my ...

7. Hibernate - Persisting polymorphic joins    stackoverflow.com

I'm trying to understand how to best implement a polymorphic one-to-many in hibernate. Eg:

@MappedSuperclass
public class BaseEntity  {
    Integer id;
    // etc...
}

@Entity
public class Author extends BaseEntity ...

8. jpa join query on a subclass    stackoverflow.com

I have the following relationships in JPA (hibernate). Object X has two subclasses, Y and Z. Object A has a manyToOne relationship to object X. (Note, this is a one-sided relationship so object ...

9. Retrieving Polymorphic Hibernate Objects Using a Criteria Query    stackoverflow.com

In my model I have an abstract "User" class, and multiple subclasses such as Applicant, HiringManager, and Interviewer. They are in a single table, and I have a single DAO to ...





10. Is it possible to *transform* the type of a polymorphic Hibernate/JPA entity?    stackoverflow.com

UPDATE: after posting, I discovered this is a duplicate of this older question.


I have an odd business requirement: my application supports users getting started as "Guests", then later registering to ...

11. Best Practises for Polymorphic JPA via Annotations    stackoverflow.com

I'm trying to set up polymorphic behaviour using Hibernate with JPA annotations. It seems sensible (maybe even necessary) to create an (abstract) class encapsulating the state and behaviours required for the inheritance ...

12. are polymorphic join tables possible in Grails    stackoverflow.com

Does anybody know if it is possible create and write to polymorphic join tables using grails. Are there any drawbacks from doing this

13. How to implement polymorphic JPA entities with generic relations    stackoverflow.com

I'm trying to use JPA 2.0 to create polymorphic entities with generic relations. There should be two tables, an event table and a notification table. Inside those table are concrete entities ...

14. polymorphic hql    stackoverflow.com

I have a base type where "business id" must be unique for a given subclass, but it is possible for there to be different subclasses with the same business id. If ...

15. Could EclipseLink be causing a ORA-00957: duplicate column name error because of a @DiscriminatorColumn in a polymorphic entity?    stackoverflow.com

I'm getting this exception in an attempt to persist an entity object in an Oracle database, and I only started getting this error after switching my JPA project to EclipseLink 2.0 ...

16. java hibernate: selecting the discriminator column in polymorphic hql query    stackoverflow.com

In hibernate, I want to select the discriminator value. Something like select discriminator, id, name, age from Animal The idea is to send the result of this query to the client side, so ...





17. How to do polymorphic queries with executeQuery() in grails?    stackoverflow.com

Why doesn't this polymorphic query work?

    String hql = """
                  ...

18. Polymorphic belongsTo in many to many mapping in grails?    stackoverflow.com

So i know this is possible using a superclass, however, this is very limiting in flexibility. So my question is then, can i use an interface? Something ala.

interface Taggable {
  ...

19. Which part of the hibernate (or similar ORM) source-code manages polymorphic inheritance?    stackoverflow.com

for some work-related reasons, which this box is too narrow to contain, we would be interested to see how hibernate (or any similar ORM tool) implements 1..N relations using inheritance + ...

20. How to perform a Non-Polymorphic JPQL query with JPA 1.0?    stackoverflow.com

imagine i have 3 Entities, Basic <- Sub <- SubSub. I want to select Basic and Sub but not SubSub I have already discovered that in JPA 2.0 I can have this ...

21. JPA TABLE_PER_CLASS problems with ManyToOne    stackoverflow.com

I have the following hierarchy

@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Order {
...
@Entity
@Table(name = "b_order", schema = "public")
public class BOrder extends Order implements java.io.Serializable {
...
@Entity
@Table(name = "s_order", schema = "public")
public class SOrder extends ...

22. JPA/hibernate order by subclass attribute    stackoverflow.com

Is it possible to query for entities of a base class, but order by an attribute of a subclass? For example, (JPA annotations omitted)

class Base
{
   int base;
}

class SubA extends Base
{
 ...

23. Polymorphic 'get' using hibernate, many to one, InheritanceType.JOINED    stackoverflow.com

I have something like this.. A Car class that has one Seat from many seats. Seat has a sub class LeatherSeat.

public class Car {
  private Seat seat;
  ...
 ...

24. How do you query by Hibernate polymorphic criteria properties    stackoverflow.com

Assume

@Entity Class Animals { } @Entity @Inheritance( stragegy = InheritanceType.JOINED) class Dogs extends Animals { private String ...

25. Hibernate - referencing abstract entity defined with     stackoverflow.com

I have an abstract entity A which has several union-subclasses. A.id generator was set to hilo (identity does not work). The other entity, B references this A entity as one-to-many (say, ...

26. Hibernate Polymorphic HQL SELECT statement    stackoverflow.com

I'm Using Hibernate annotation to persist my classes. Currently I'm using the following strategy to map the classes I have an abstract class which is the Parent class, and I have two sub-classes ...

27. Hibernate gives PSQLException for polymorphic query on "any"    coderanch.com

When I try to query on an "any" association with Hibernate 3.2/PostgresQL 8.0.3 (i.e. find all objects with a certain object in one of its fields, and that field is a java interface), I get an error from inside postgres complaining that too many columns are being bound. It is very easy to reproduce with just a little code, all of ...

29. OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance    coderanch.com

I have trouble with a polymorphic unidirectional relation with single tabled inheritance. As not yet have that much experiences from JPA programming am I not quite sure if I break any syntactic rules or if it is a bug. I use OpenJPA 2 and have a class Depot which have a unidirectional relation to transactions that implements DepotTransactions where the class ...

30. JPA: Polymorphic Queries    java.net

I believe you would have to either copy the query to a new one which uses the subclass, or somehow query for the subclass discriminator column (using .class?). In other words, the caller would choose what subclass by setting the discriminator as a parameter. I'm not 100% sure if the second method works or not (I have had mixed results depending ...

31. Duplicate property name causing issues in polymorphic assoc.    forum.hibernate.org

I'm a newbie to Hibernate and JPA and am hoping that some of you with more experience can help me out with some unexpected behavior that I've been seeing in Hibernate. I'm using a table-per-subclass inheritance strategy in which a subset of my subclasses share a duplicate property name. I didn't want to pull this property into the base class, since ...

32. polymorphic reference to a 3rd party interface    forum.hibernate.org

33. Query on polymorphic association    forum.hibernate.org

34. One-to-one relationship with polymorphic entity    forum.hibernate.org

Newbie Joined: Wed Jun 17, 2009 11:08 am Posts: 7 Hello there: the application I'm working on requires two entities with a one-to-one relationship, with one end of the relationship being polymorphic. For the sake of illustration, I'll use a variation of an example from the "Java Persistence with Hibernate" book. Consider the entities from section "7.3.1 Polymorphic many-to-one associations": Code: ...

35. What should be a basic polymorphic association question:    forum.hibernate.org

Ok, so I have the following objects: Code: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn( name="behavior_type", discriminatorType=DiscriminatorType.STRING ) @DiscriminatorValue("none") public class BehaviorData implements BehaviorDataInfo{ ... } which is extended by four other classes, of which this is an example: Code: @Entity @DiscriminatorValue("modifier") public class CasualtyRateBehaviorData extends BehaviorData { ... ...

36. Mapping Polymorphic Queries With Annotations    forum.hibernate.org

I have a basic skeleton here and I am finding it really tough to map Polymorphic Queries with annotations. Provided that I have a location field in each item type (offence and defence) How would I go about bidirectionally mapping this query, or even unidirectionally for that matter? I really appreciate any help, mixing all of this together for such an ...

37. Issue in restricting polymorphic query results    forum.hibernate.org

Hi, I'm using JPA 2.0, Hibernate 3.5.0-Beta4, MySQL 5.1 on Glassfish v3. I want to limit the polymorphic query results using JPA 2.0 syntax (TYPE) : SELECT e FROM Employee e WHERE TYPE(e) IN (FullTime, Executive) but it seems that Hibernate 3.5.0-Beta4 doesn't support this syntax because in the generated sql query the 'type' keyword remains unmapped and MySQL throws an ...

38. Troublesome bug with polymorphic query using TABLE_PER_CLASS    forum.hibernate.org

em.createQuery("SELECT f FROM Foo as f") Hibernate: select foo0_.id as id0_, foo0_.toys as toys1_, foo0_.toys as toys3_, foo0_.clazz_ as clazz_ from ...

39. Mapping polymorphic entities using interfaces: possible?    forum.hibernate.org

Hello all, I have the following interface and class layout: Code: public interface InstanceManager { public ManagedInstance getManagedInstance(String key); public void addManagedInstance(String key, ManagedInstance instance); public void removeManagedInstance(String key); } public interface ManagedInstance { public InstanceManager getOwner(); // ... other methods of the managed instance } ...

40. Polymorphic association with table per subclass inheritence    forum.hibernate.org

I'm not seeing the 2cd level cache hit for a List in a base class and I'm wondering if the subclasses inherit the many-to-one link setup in the base class. The object I start with is actually a subtype (not shown here) of the ManagedObject class. I can see the top level object (ManagedObject) hit in the cache but the children ...

43. Polymorphic relationship and ID auto increment    forum.hibernate.org

Newbie Joined: Thu Sep 23, 2010 11:14 am Posts: 7 Hi All!! This is my first post in this forum. I will try to be clear with my problem. I have some clases and it's interfaces: Interface Element (top level) Code: public interface Element { public final long nullID ...

44. Facing problem while writing a polymorphic report query    forum.hibernate.org

I've a scenario which I'm finding difficult to solve using a hql named query. Please if anybody can help. I have Entities with all the relationships been defined using annotations. I've a case where I wanted to write a report query which fetches me all the details in a single DB interaction. The case is: The relationships between entities are: Person ...

45. Polymorphic Criteria Query Bug in 3.5.6?    forum.hibernate.org

Hibernate Version: 3.5.6 I came across this one earlier today... while it's definitely possible that I'm overlooking something obvious here, it seems that the current implementation of Criteria ignores (partially, at least) restrictions on properties that appear in multiple subclasses of a class hierarchy (mapped using a table per subclass strategy). For a simplified example to demonstrate the issue that I'm ...

46. using class property in polymorphic hql query    forum.hibernate.org

hi everybody, i have a polymorphic hql query with joins and want to retrieve only a concrete subclass for one of the objects contained in the query. i know that setting the corresponding base class abstract helps (tried it;) but this has lot of impact on my app, so another solution would just be fine. now i got the hint that ...

47. How to perform a non-polymorphic HQL query in Hibernate?    forum.hibernate.org

Hi all, I'm using Hibernate 3.3, and in particular, I'm using HQL queries. According to the documentation, Hibernate's queries are polymorphic: Quote: A query like: from Cat as cat returns instances not only of Cat, but also of subclasses like DomesticCat. How can I query for instances of Cat, but not of any of its subclasses? I'm aware of the following ...

48. Polymorphic Query Optimization?    forum.hibernate.org

I have a OneToMany relationship between two entities and when invoking a method on the lazy loaded Parent object after calling getParent() from the Child, Hibernate (3.5.6GA) invokes a huge polymorphic query with all the left outer joins. The Parent does have over 30 different entity types in my system, so this makes sense that Hibernate needs the query to determine ...

49. Implementing polymorphic associations - "unexpected entity"?    forum.hibernate.org

Hi, I'm not a very experienced hibernate user, such that I've actually never had to store inherited classes before, but now it is time. Based on the scant available documentation, I have the following, implemented as a table-per-class hierarchy but it is throwing exceptions: Java class structure (abbreviated; a potentially complicating factor is that the classes in question are static inner ...

50. Order by polymorphic hql querys    forum.hibernate.org

@Entity @Inheritance(strategy=SINGLE_TABLE) @DiscriminatorFormula(value = "case " + " when (ACTIVO = 'S' AND TYPE_CUSTOMER = 'A') then 'A' " + " when (ACTIVO = 'S' AND TYPE_CUSTOMER = 'B') then 'B' " + " when (ACTIVO = 'S' AND TIPO = 'C') then ...

51. SQL manual data migration, problems with polymorphic entity    forum.hibernate.org

Hi all, Hibernate 3.6.5.Final, MySQL 5.5, JDK 1.7. I've extended an Entity to have a new child class using the JOINED inheritance strategy, and tried to migrate data in using low level SQL (a Liquibase changelog) rather than Java code to create the database rows for the Entities. I find that fetching these migrated entities fails to recognise them as specialised ...

52. Criteria API, outer joins and polymorphic persistence    forum.hibernate.org

Big subject, easy question. I have an HQL query that looks like this: Code: select distinct business from com.sa.go.bto.Business as business inner join business.locations as location ...

53. mapping map to polymorphic values    forum.hibernate.org

I need advice on how to map a rather complex field in one of my persistent classes. I have a java.util.Map that maps from a key to one of several possible objects. It's probably best to use a silly example: Alice -> PERSON(wife) Bob -> TEACHER(daughter's teacher) Duke -> DOG (a TEACHER extends PERSON, although I'm not always sure this is ...

54. Problem with mapping a polymorphic structure    forum.hibernate.org

Hello, I got a problem with persistency mapping of a class hierarchy. Here's the case; My Hibernate mapping file is as below;

55. polymorphic persistence    forum.hibernate.org

I am trying to map a class and sublass but when i try to build session factory it gives : net.sf.hibernate.MappingException: discriminator mapping required for polymorphic persistence at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:683) at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:29) at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:207) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627) I am mapping subclass as : How to give mapping for polymorphic persistence ? It is still ...

56. polymorphic getter     forum.hibernate.org

hi there, i have a hopefully easy question to answer for you. given the following code and mappings. how do i get hibernate executing without throwing an exception. now the classes being used Code: public class Job{ private String id_; private String department_; private Employee emp_; public String getId{return id_;} public ...

57. Polymorphic mapping using interfaces    forum.hibernate.org

Hi everyone, I have three classes Company, Division and SubDivision all implementing the interface DirectedUnit and one more Class Director. What I wish to do is a to map a relation (in this special case a one to one relation, but this is just an example and I'd like to keep the disussion more general) between DirectedUnit and Director. My favorite ...

58. Mapping legacy polymorphic hierarchy    forum.hibernate.org

I understand (I think) the three strategies for mapping that Hibernate supports. However, I have a mapping strategy from a legacy persistence mechanism that I have to match. Changing the database isn't an option - we have terabytes of data stored and millions of lines of legacy code that needs to be preserved. The mapping strategy uses a table-per-subclass, with discriminator, ...

59. Criteria API and polymorphic queries    forum.hibernate.org

I have the following [sub]class structure: A <- B <- C (where B is a superclass of C and a child class of A), with discriminator values 'a', 'b' and 'c' accordingly, and using explicit polymorphism. I'm trying to do queries which only return instances of the needed class, no subclasses. Using the query language, I have zero problems doing so, ...

60. [Advice] polymorphic mapping    forum.hibernate.org

/** * @hibernate.class * table = "t_exchanges" */ public class Exchange extends Saveable { Party sender; Party recipient; Date when; String comment; /** * @hibernate.many-to-one ...

61. advanced polymorphic queries    forum.hibernate.org

i'm using implicit polymorphism with the table-per-subclass inheritance scheme (though i could be argued to try another scheme if it helps). i'm trying to write a query that would do something like: say, eg.MeanCat extends eg.Cat and adds a property irritability.. from eg.Cat as cat where (cat.class = eg.MeanCat and cat.irritability > 5) or (cat.class = eg.DomesticCat) which would then select ...

62. polymorphic collection example    forum.hibernate.org

first, i HAVE read chapter 6 & 8 trying to have a collection of classes that implement the same interface, stored in a parent object (one-many) possible? i'm using the table per-class hierachy strategy, which seems logical, and works if i try to persist any of the concreate classes individually.. but if i try to save the parent, with a polymorphic ...

63. Polymorphic queries, attribute of subclass via superclass    forum.hibernate.org

Suppose I have the following class relationship. public class Plane { int wings; // number of wings. // etc. } public class JetPlane { int numPilots; String model; // etc. } I now do this. List results = session.createCriteria(Plane.class) .add(Expression.eq("model", "AirBus"); I get this. 1) testPlanesByCriteria2(com.ap.ApTest)java.lang.NullPointerException at net.sf.hibernate.persister.NormalizedEntityPersister.toColumns(NormalizedEntityPersister.java:1099) at net.sf.hibernate.expression.AbstractCriterion.getColumns(AbstractCriterion.java:35) at net.sf.hibernate.expression.SimpleExpression.toSqlString(SimpleExpression.java:40) at net.sf.hibernate.loader.CriteriaLoader.(CriteriaLoader.java:66) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3591) at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238) at com.ap.ApTest.testPlanesByCriteria2(ApTest.java:305) at ...

64. Polymorphic derived properties    forum.hibernate.org

65. polymorphic query with legacy database    forum.hibernate.org

Hibernate version: 2.1.4 Hi folks, I'm using Hibernate on a project with a legacy database and I've run into an issue with polymorphic queries. I'm trying to load an abstract Prescription class that could be a DrugProduct or DrugCompound concrete type. I know Hibernate can do this via discriminators but being a legacy DB we do not have a proper Type ...

66. question about polymorphic query behavior    forum.hibernate.org

Hibernate version: 2.1.6 hi all, i'm new to hibernate and have a question about the behavior of polymorphic queries using Session.get(class, serializable). i'm using the table per class hierarchy model. i've found, by mistake, something that i think shouldn't work, but does. here's the scenario. i have three classes, {A, B, C}, for which A is abstract and B & C ...

67. Polymorphic serialization not allowed?    forum.hibernate.org

Hibernate version:2.1 I have a class called PropertyRight which has a property called "modifyValidator". This property is supposed to store a serialized Java object of type Validator. Validator is an interface, and I have a huge number of classes which implement Validator. Hibernate accepts my mapping file in which I have specified the property as ...

68. Polymorphic HQL question ...    forum.hibernate.org

I am using Hibernate 2.1.6 and the Table Per Subclass (joined subclass) method of inheritance mapping. If I have the following inheritance hierarchy ... B -> Base Class C -> Inherits from B D -> Inherits from B I can retrieve all instances by using HQL of the form ... "from B as b" However, if I attempt to do something ...

69. Polymorphic associations with dynamic classes?    forum.hibernate.org

Hibernate version: 3.0 alpha Reading through the Hibernate in Action book, I can across this example in section 6.4.3: There was a user class/table and two associations a credit card, and a bank account. Depending on the discriminator in the user class (billing_details_type), it associated with either the credit card class or the bank account class. I have a similar schema ...

70. Polymorphic queries    forum.hibernate.org

I have class B which extends class A. Both have their own mappings, but there is no relationship mentioned between them in this mappings. I'm executing query on class A and I also get instances of class B. Ok, looking through source I see that QueryTranslator picks up (factory.getImplementors) all classes that are subclasses, so behaviour is normal. What if I'm ...

71. Using example queries on Polymorphic objects    forum.hibernate.org

Not sure what the cause of the exception is, but I would think that the Criteria API is a good way of doing things. You needn't resort to a complex if/else tree of code - surely you could put the paramters in a Map and then iterate through the keys and add Expression objects to the Criteria in a loop? Would ...

72. "polymorphic" queries, unique subclass fields    forum.hibernate.org

Author Message afisk Post subject: "polymorphic" queries, unique subclass fields Posted: Tue Dec 07, 2004 6:40 pm Newbie Joined: Tue Dec 07, 2004 5:06 pm Posts: 4 Hibernate version: 2.1.6 Mapping documents: Code:

73. Polymorphic mapping not as expected    forum.hibernate.org

Newbie Joined: Wed Aug 27, 2003 8:35 am Posts: 6 Location: Tampa, FL You'll find all the debug info below. I've seen a few moderately similar problems posted in the forum, but nothing seems to fix me. Here's what I've got. A class hierarchy starting with: Authorization - UserAuthorization -- UserActivationAdjustmentAuthorization -- UserTimebankAdjustmentAuthorization I would expect to be able to say ...

74. single point polymorphic association fetching    forum.hibernate.org

When using for a single point polymorphic association, how can I efficiently retrieve the associated entities? e.g. Code: ... ...

75. Inheritance and polymorphic associations    forum.hibernate.org

76. anti-polymorphic query    forum.hibernate.org

77. polymorphic collection with table-per-concrete-class    forum.hibernate.org

hello *, how can I map a polymorphic collection with table-per-concrete-class? E.g. I have a class Person (with a table person) with a set of pets and the classes cat and dog. The classes cat and dog extend the abstract class pet. Each person has cat's and/or dogs and each pet has exactly one person as owner. Which example in the ...

78. Is there a direct mechanism to map a polymorphic collection?    forum.hibernate.org

Is there a direct mechanism in Hibernate that can be used for mapping a collection of polymorphic objects? My limited knowledge of the platform is that (a) Hibernate is always surprising me with what it implements up front, but (b) This mapping is not "relational" in the classical sense of the word, so an Object Relational Mapping is only a partial ...

79. Polymorphic association in Hibernate    forum.hibernate.org

Hi guys, I have a question about the polymorphic associations in Hibernate. Imagine I have an object, that contains a set of objects implementing the same interface but being mapped to different tables. They have absolutly different properties. These objects are declared as entities in Hibernate. having their own life cycle. So they can not be mapped as component. So I ...

80. Problems with Table per class polymorphic mapping    forum.hibernate.org

Newbie Joined: Mon Jan 31, 2005 11:22 am Posts: 1 I am having some difficulties implementing a "Table per class" inheritance mapping, as described in "Hibernate in Action" section 3.6.2. Basically, I have a class called "ChangeRequest", which contains a Set collection called "affectedEntities". These affectedEntities are Objects derived from a CrEntity class - the derived classes are called CrAircraft and ...

81. Polymorphic Mapping Q - Single Child/Polymorphic Parents    forum.hibernate.org

I've been using Hibernate for the past few months, and have bumped up against a mapping question that I haven't seen referenced in the forums or wiki. I've got a polymorphic parent object that has a child that I'd like to reuse among different parent types. An example: Say I have a Content base class with two subclasses: Article and Discussion. ...

82. Polymorphic mapping: Parameter index out of range    forum.hibernate.org

Hibernate version: 3.0.2 Mapping documents:

83. polymorphic query in HQL using unmapped interface?    forum.hibernate.org

Hibernate version: 3.0rc1 I read in the documentation (sections 9.1.6/9.1.7) that, using implicit polymorphism it is possible to query using some base interface and essentially get all classes which implement the interface and match the query. Well, I'm trying to use HQL to perform this (see code snippet below): Code: ... java classes ... public inteface BaseI {} public class BaseClass ...

84. Query on polymorphic association can't access subclass props    forum.hibernate.org

Newbie Joined: Thu Oct 09, 2003 11:07 pm Posts: 6 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 2.1.8 Mapping documents: