Object to relational mapping with Hibernate?

Feature Requests, Comments, Bugs, and Suggestions on the JSpiff XSPF Java API.

Object to relational mapping with Hibernate?

Postby mickknutson » Tue Jan 23, 2007 5:47 pm

I am wondering how hard it would be to use Hibernate to and from JSpiff so that I could store my xspf playlists in my database?
mickknutson
 

Postby Melloware » Tue Jan 23, 2007 7:29 pm

Well that is a tricky question that could have two answers that are both YES it can be done, and its easy depending on how you want to do it.

1. You could create Hibernate mapping files (.hbm) that map to the object graph of the XSPF objects in JSPIFF. That would take some time and the right database structure but should be totally possible and work. This would require your database tables to almost mimic the possibilities in an XSPF file. I would NOT recommend this approach unless you absolutely wanted to query fields from your XSPFs.

2. IF, you wanted to store the whole actual file in a database field using Hibernate that is actually pretty easy. You actually just use JSPIFF as normal to read and write the XSPF XML files and then use Hibernate to store the XML file and retrieve it from a BLOB field in one of your database tables. For an example of this look at the following article from Stripes MVC Framework:

http://stripes.mc4j.org/confluence/disp ... +Hibernate
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11050
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

hyperjaxb2

Postby Melloware » Thu Apr 12, 2007 1:53 pm

An even better solution is to use the JAXB implementation of JSPIFF and then you can use HyperJaxb2

https://hyperjaxb2.dev.java.net/

Hyperjaxb provides a solution for the prevalent task of XML persistence which essentially lies in the following three operations:

* importing or saving the document;
* exporting or loading the document;
* querying for documents or their parts.

To solve this task, Hyperjaxb combines two technogies: Java Architecture for XML Binding and Hibernate. JAXB converts between XML and objects; Hibernate is used to persist object in a relational database.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11050
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Object to relational mapping with Hibernate?

Postby martin.lawrence » Mon Feb 15, 2010 4:24 am

I installed JW Player 5.0.753. When I used xspf to direct the player, the player reported the following error:

Loaded file is not a valid media provider.

The problem seems to be that xspf doesn't provide a meta tag which defines the provider type (in this case http).

I created a patch to address this. The patch is wired to http - so it would need to some work to support rtmp.
martin.lawrence
 
Posts: 1
Joined: Mon Feb 15, 2010 4:20 am


Return to JSpiff (closed)

Who is online

Users browsing this forum: No registered users and 2 guests

cron