Hi Dave,
I know of three ways to import data in MMBase:
1. use the application XMLImporter;
http://www.mmbase.org/mmdocs/applications/xmlimporter/
frontenddevelopers/xmlimporter/index.html
Which has as disadvantage that it can not import a lot in one go. But
has the main advantage that it can merge or match existing nodes and
can create relations with existing nodes in your cloud.
2. create a JSP with the MMBase taglib;
Can import more data in one go, depending on your destination servers
limits.
3. write an MMBase application (I) file.
Complicated to generate when not generated from MMBase, but can be
very flexible
http://www.mmbase.org/mmdocs/informationanalysts/applications.html
4. or write your own set of classes importing the data using the
MMBase bridge.
The first two options look like this:
ad 1. Generate at the source and import in MMBase with the XMLImporter:
<createObject type="pool" id="pool">
<setField name="name"><![CDATA[Pool]]></setField>
</createObject>
<createObject type="news" id="info_140">
<setField name="title">Bla</setField>
<setField name="body"><![CDATA[More bla]]></setField>
</createObject>
<createRelation source="pool" destination="info_140" type="posrel">
<setField name="pos"><![CDATA[0]]></setField>
</createRelation>
ad 2. Generate at the source:
<mm_node number="pool_alias" id="pool" />
<mm_createnode type="text" id="info_140">
<mm_setfield name="title">Bla</mm_setfield>
<mm_setfield name="body">This municipality has no website. Click
the link to open..</mm_setfield>
</mm_createnode>
<mm_createrelation source="pool" destination="info_140"
role="related" />
convert it to a working JSP:
<mm:node number="pool_alias" id="pool" />
<mm:createnode type="text" id="info_140">
<mm:setfield name="title">Bla</mm:setfield>
<mm:setfield name="body">This municipality has no website. Click
the link to open..</mm:setfield>
</mm:createnode>
<mm:createrelation source="pool" destination="info_140"
role="related" />
And open te JSP at your destination to import all data.
---André
Op 7-jul-2006, om 13:45 heeft Dave Schoorl het volgende geschreven:
Thanks Nico for your wisdom. After considering my options, I think
it's most practical to write an import/conversion-tool and do a
manual export/import periodically (In my use case this procedure
will probably be done on a weekly basis).
Is this kind of tool already available within the mmbase source
repository? It must be capable of handling inserts, updates and
deletes and replacing the foreign keys with the mmbase object
identifier. If not, would the mmbase community be interested in
donation of this tool to the mmbase project?
Thanks,
Dave
Nico Klasens wrote:
Just to be clear on the subject. MMBase is not an ORM tool like
hibernate. It is not developed to fit on any existing database.
MMBase is a darta repository which is backed by a database. MMBase
does its own object type and relation management. It uses some
tables and fields to manage these types and relations. it is
easier to implement a migration tool to import than custimizing
MMBase for your database.
Just my 2ct
Nico Klasens
Finalist IT Group
Dave Schoorl wrote:
MMBase has in general a good fit with our requirements. We
selected it from a list of 7 Open Source CMS packages. I cannot
imagine that mmbase puts such tight restrictions on the database
structure, that foreign keys on non-integer fields are (or can)
not (be) supported. And that this can not be solved within a
reasonable effort. Furthermore, I think that a more profound
support of foreign keys by mmbase would make this product
interesting for a wider audience and would make migration from
another CMS to mmbase easier (In our case, we are migrating our
current CMS plus disclosing information from a separate 'client/
server'-type application in the migrated CMS system).
I am a Java Developer and I don't want to give up so soon and
report back that our careful package selection was not careful
enough (just yet).
Best regards,
Dave
Edwin van der Elst wrote:
Maybe using MMBase for this is not the best solution. You might
want to look into other otions. ORM tools like Hibernate or JDO
are better suited for mapping objects to existing
databaseschema's and have nice query languages too.
(Others on this list will probably disagree :-)
Edwin van der Elst
Finalist IT Group
________________________________
Van: [EMAIL PROTECTED] namens Dave Schoorl
Verzonden: wo 5-7-2006 20:43
Aan: Discussion list for developers
Onderwerp: [Developers] Node relationships on non-integer
primary key
L.S.
I am new to mmbase and am assigned the task to disclose existing
information from a MySQL-database to the web using mmbase.
Tables are
related using foreign keys and the database is normalized. Since
the
database is also used for another application, I have little
freedom to
adjust the database structure.
-------------------------------------------------------------------
-----
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers
--
André van Toly
MMBase development & Userfriendly webdesign
W: http://www.toly.nl
M: +31(0)627233562
------------------------------------------------------------------
~~<<>>~~
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers